[Python-checkins] cpython: Use strings instead of sets of lines in packaging.create tests.
eric.araujo
python-checkins at python.org
Tue Jun 7 17:32:03 CEST 2011
http://hg.python.org/cpython/rev/5853356e2359
changeset: 70705:5853356e2359
user: Éric Araujo <merwok at netwok.org>
date: Mon Jun 06 20:59:56 2011 +0200
summary:
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.
files:
Lib/packaging/tests/test_create.py | 116 ++++++++--------
1 files changed, 61 insertions(+), 55 deletions(-)
diff --git a/Lib/packaging/tests/test_create.py b/Lib/packaging/tests/test_create.py
--- a/Lib/packaging/tests/test_create.py
+++ b/Lib/packaging/tests/test_create.py
@@ -13,6 +13,7 @@
support.EnvironRestorer,
unittest.TestCase):
+ maxDiff = None
restore_environ = ['PLAT']
def setUp(self):
@@ -130,43 +131,45 @@
main()
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(lines, set(['',
- '[metadata]',
- 'version = 0.2',
- 'name = pyxfoil',
- 'maintainer = André Espaze',
- 'description = My super Death-scription',
- ' |barbar is now on the public domain,',
- ' |ho, baby !',
- 'maintainer_email = andre.espaze at logilab.fr',
- 'home_page = http://www.python-science.org/project/pyxfoil',
- 'download_url = UNKNOWN',
- 'summary = Python bindings for the Xfoil engine',
- '[files]',
- 'modules = my_lib',
- ' mymodule',
- 'packages = pyxfoil',
- ' babar',
- ' me',
- 'extra_files = Martinique/Lamentin/dady',
- ' Martinique/Lamentin/mumy',
- ' Martinique/Lamentin/sys',
- ' Martinique/Lamentin/bro',
- ' Pom',
- ' Flora',
- ' Alexander',
- ' setup.py',
- ' README',
- ' pyxfoil/fengine.so',
- 'scripts = my_script',
- ' bin/run',
- 'resources =',
- ' README.rst = {doc}',
- ' pyxfoil.1 = {man}',
- ]))
+ self.assertEqual(contents, dedent("""\
+ [metadata]
+ name = pyxfoil
+ version = 0.2
+ summary = Python bindings for the Xfoil engine
+ download_url = UNKNOWN
+ home_page = http://www.python-science.org/project/pyxfoil
+ maintainer = André Espaze
+ maintainer_email = andre.espaze at logilab.fr
+ description = My super Death-scription
+ |barbar is now on the public domain,
+ |ho, baby !
+
+ [files]
+ packages = pyxfoil
+ babar
+ me
+ modules = my_lib
+ mymodule
+ scripts = my_script
+ bin/run
+ extra_files = Martinique/Lamentin/dady
+ Martinique/Lamentin/mumy
+ Martinique/Lamentin/sys
+ Martinique/Lamentin/bro
+ setup.py
+ README
+ Pom
+ Flora
+ Alexander
+ pyxfoil/fengine.so
+
+ resources =
+ README.rst = {doc}
+ pyxfoil.1 = {man}
+
+ """))
def test_convert_setup_py_to_cfg_with_description_in_readme(self):
self.write_file((self.wdir, 'setup.py'),
@@ -203,26 +206,29 @@
# FIXME Out of memory error.
main()
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(['',
- '[metadata]',
- 'version = 0.2',
- 'name = pyxfoil',
- 'maintainer = André Espaze',
- 'maintainer_email = andre.espaze at logilab.fr',
- 'home_page = http://www.python-science.org/project/pyxfoil',
- 'download_url = UNKNOWN',
- 'summary = Python bindings for the Xfoil engine',
- 'description-file = README.txt',
- '[files]',
- 'packages = pyxfoil',
- 'extra_files = pyxfoil/fengine.so',
- ' pyxfoil/babar.so',
- 'resources =',
- ' README.rst = {doc}',
- ' pyxfoil.1 = {man}',
- ]))
+ self.assertEqual(contents, dedent("""\
+ [metadata]
+ name = pyxfoil
+ version = 0.2
+ summary = Python bindings for the Xfoil engine
+ download_url = UNKNOWN
+ home_page = http://www.python-science.org/project/pyxfoil
+ maintainer = André Espaze
+ maintainer_email = andre.espaze at logilab.fr
+ description-file = README.txt
+
+ [files]
+ packages = pyxfoil
+ extra_files = pyxfoil/fengine.so
+ pyxfoil/babar.so
+
+ resources =
+ README.rst = {doc}
+ pyxfoil.1 = {man}
+
+ """))
def test_suite():
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list