diff options
Diffstat (limited to 'distutils2/tests/test_run.py')
| -rw-r--r-- | distutils2/tests/test_run.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/distutils2/tests/test_run.py b/distutils2/tests/test_run.py index 7433731..d8730fc 100644 --- a/distutils2/tests/test_run.py +++ b/distutils2/tests/test_run.py @@ -60,21 +60,42 @@ class RunTestCase(support.TempdirManager, os.chmod(install_path, old_mod) install.get_path = old_get_path - def test_show_help(self): - # smoke test, just makes sure some help is displayed + def get_pythonpath(self): pythonpath = os.environ.get('PYTHONPATH') d2parent = os.path.dirname(os.path.dirname(__file__)) if pythonpath is not None: pythonpath = os.pathsep.join((pythonpath, d2parent)) else: pythonpath = d2parent + return pythonpath + + def test_show_help(self): + # smoke test, just makes sure some help is displayed + status, out, err = assert_python_ok( + '-m', 'distutils2.run', '--help', + PYTHONPATH=self.get_pythonpath()) + self.assertEqual(status, 0) + self.assertGreater(out, b'') + self.assertEqual(err, b'') - status, out, err = assert_python_ok('-m', 'distutils2.run', '--help', - PYTHONPATH=pythonpath) + def test_list_commands(self): + status, out, err = assert_python_ok( + '-m', 'distutils2.run', 'run', + '--list-commands', PYTHONPATH=self.get_pythonpath()) + # check that something is displayed self.assertEqual(status, 0) self.assertGreater(out, b'') self.assertEqual(err, b'') + # make sure the manual grouping of commands is respected + check_position = out.find(b' check: ') + build_position = out.find(b' build: ') + self.assertTrue(check_position, out) # "out" printed as debugging aid + self.assertTrue(build_position, out) + self.assertLess(check_position, build_position, out) + + # TODO test that custom commands don't break --list-commands + def test_suite(): return unittest.makeSuite(RunTestCase) |
