diff options
| author | Éric Araujo <merwok@netwok.org> | 2011-05-28 23:32:50 +0200 |
|---|---|---|
| committer | Éric Araujo <merwok@netwok.org> | 2011-05-28 23:32:50 +0200 |
| commit | b62fd2a2e3fed4d2ad97131f67cbc77c19246431 (patch) | |
| tree | 1882fae9f09c16f1fbb034ddca8adfc0d441fd59 /tests/test_build_py.py | |
| parent | 8c2ad1791ef7504de9f6483af7617da21cc53daf (diff) | |
| download | python-setuptools-git-b62fd2a2e3fed4d2ad97131f67cbc77c19246431.tar.gz | |
Fix test_build_py when sys.dont_write_bytecode is true (#9831).
The tests now pass all combinations of -O/-OO and -B. See also #7071
and #6292 for previous variations on the same theme.
test_versionpredicate needs a skip when sys.flags.optimize is true, but
I don’t know how to make that work with a DocTestSuite.
Diffstat (limited to 'tests/test_build_py.py')
| -rw-r--r-- | tests/test_build_py.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/test_build_py.py b/tests/test_build_py.py index da3232ce..4e46339b 100644 --- a/tests/test_build_py.py +++ b/tests/test_build_py.py @@ -57,11 +57,15 @@ class BuildPyTestCase(support.TempdirManager, self.assertEqual(len(cmd.get_outputs()), 3) pkgdest = os.path.join(destination, "pkg") files = os.listdir(pkgdest) - self.assertTrue("__init__.py" in files) - self.assertTrue("__init__.pyc" in files) - self.assertTrue("README.txt" in files) - - def test_empty_package_dir (self): + self.assertIn("__init__.py", files) + self.assertIn("README.txt", files) + # XXX even with -O, distutils writes pyc, not pyo; bug? + if sys.dont_write_bytecode: + self.assertNotIn("__init__.pyc", files) + else: + self.assertIn("__init__.pyc", files) + + def test_empty_package_dir(self): # See SF 1668596/1720897. cwd = os.getcwd() @@ -109,7 +113,7 @@ class BuildPyTestCase(support.TempdirManager, finally: sys.dont_write_bytecode = old_dont_write_bytecode - self.assertTrue('byte-compiling is disabled' in self.logs[0][1]) + self.assertIn('byte-compiling is disabled', self.logs[0][1]) def test_suite(): return unittest.makeSuite(BuildPyTestCase) |
