Commit a0892ced authored by Éric Araujo's avatar Éric Araujo

Use strings instead of sets of lines in packaging.create tests.

Using sets in tests did not check whether the values were written in the right
section or with the right key.
parent 8e0aad61
...@@ -13,6 +13,7 @@ class CreateTestCase(support.TempdirManager, ...@@ -13,6 +13,7 @@ class CreateTestCase(support.TempdirManager,
support.EnvironRestorer, support.EnvironRestorer,
unittest.TestCase): unittest.TestCase):
maxDiff = None
restore_environ = ['PLAT'] restore_environ = ['PLAT']
def setUp(self): def setUp(self):
...@@ -130,43 +131,45 @@ class CreateTestCase(support.TempdirManager, ...@@ -130,43 +131,45 @@ class CreateTestCase(support.TempdirManager,
main() main()
with open(os.path.join(self.wdir, 'setup.cfg'), encoding='utf-8') as fp: with open(os.path.join(self.wdir, 'setup.cfg'), encoding='utf-8') as fp:
lines = set(line.rstrip() for line in fp) contents = fp.read()
# FIXME don't use sets self.assertEqual(contents, dedent("""\
self.assertEqual(lines, set(['', [metadata]
'[metadata]', name = pyxfoil
'version = 0.2', version = 0.2
'name = pyxfoil', summary = Python bindings for the Xfoil engine
'maintainer = André Espaze', download_url = UNKNOWN
'description = My super Death-scription', home_page = http://www.python-science.org/project/pyxfoil
' |barbar is now on the public domain,', maintainer = André Espaze
' |ho, baby !', maintainer_email = andre.espaze@logilab.fr
'maintainer_email = andre.espaze@logilab.fr', description = My super Death-scription
'home_page = http://www.python-science.org/project/pyxfoil', |barbar is now on the public domain,
'download_url = UNKNOWN', |ho, baby !
'summary = Python bindings for the Xfoil engine',
'[files]', [files]
'modules = my_lib', packages = pyxfoil
' mymodule', babar
'packages = pyxfoil', me
' babar', modules = my_lib
' me', mymodule
'extra_files = Martinique/Lamentin/dady', scripts = my_script
' Martinique/Lamentin/mumy', bin/run
' Martinique/Lamentin/sys', extra_files = Martinique/Lamentin/dady
' Martinique/Lamentin/bro', Martinique/Lamentin/mumy
' Pom', Martinique/Lamentin/sys
' Flora', Martinique/Lamentin/bro
' Alexander', setup.py
' setup.py', README
' README', Pom
' pyxfoil/fengine.so', Flora
'scripts = my_script', Alexander
' bin/run', pyxfoil/fengine.so
'resources =',
' README.rst = {doc}', resources =
' pyxfoil.1 = {man}', README.rst = {doc}
])) pyxfoil.1 = {man}
"""))
def test_convert_setup_py_to_cfg_with_description_in_readme(self): def test_convert_setup_py_to_cfg_with_description_in_readme(self):
self.write_file((self.wdir, 'setup.py'), self.write_file((self.wdir, 'setup.py'),
...@@ -203,26 +206,29 @@ ho, baby! ...@@ -203,26 +206,29 @@ ho, baby!
# FIXME Out of memory error. # FIXME Out of memory error.
main() main()
with open(os.path.join(self.wdir, 'setup.cfg'), encoding='utf-8') as fp: with open(os.path.join(self.wdir, 'setup.cfg'), encoding='utf-8') as fp:
lines = set(line.rstrip() for line in fp) contents = fp.read()
self.assertEqual(lines, set(['', self.assertEqual(contents, dedent("""\
'[metadata]', [metadata]
'version = 0.2', name = pyxfoil
'name = pyxfoil', version = 0.2
'maintainer = André Espaze', summary = Python bindings for the Xfoil engine
'maintainer_email = andre.espaze@logilab.fr', download_url = UNKNOWN
'home_page = http://www.python-science.org/project/pyxfoil', home_page = http://www.python-science.org/project/pyxfoil
'download_url = UNKNOWN', maintainer = André Espaze
'summary = Python bindings for the Xfoil engine', maintainer_email = andre.espaze@logilab.fr
'description-file = README.txt', description-file = README.txt
'[files]',
'packages = pyxfoil', [files]
'extra_files = pyxfoil/fengine.so', packages = pyxfoil
' pyxfoil/babar.so', extra_files = pyxfoil/fengine.so
'resources =', pyxfoil/babar.so
' README.rst = {doc}',
' pyxfoil.1 = {man}', resources =
])) README.rst = {doc}
pyxfoil.1 = {man}
"""))
def test_suite(): def test_suite():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment