diff options
author | Buck Golemon <buck@yelp.com> | 2014-11-14 14:00:27 -0800 |
---|---|---|
committer | Buck Golemon <buck@yelp.com> | 2014-11-14 14:00:27 -0800 |
commit | d05360a060187452f49302467f87ead09d27c9ba (patch) | |
tree | 9e82e20acb7358109ffd77de863088faf7a7c0eb /tests | |
parent | a3cb81edd6053a273447ba3821655320ed234a41 (diff) | |
download | python-coveragepy-git-d05360a060187452f49302467f87ead09d27c9ba.tar.gz |
ModuleFinder no longer takes a main-module argument.
--HG--
branch : __main__-support
extra : rebase_source : 3f4c29876960153907b65b6e8e818b8228ca4ec0
extra : histedit_source : 6567adaf9c89483b71501fd91e9d3c83ed3daec7%2C2c5c8a7af95b8b26af384b9a65815d077e4313ec
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_cmdline.py | 9 | ||||
-rw-r--r-- | tests/test_files.py | 39 |
2 files changed, 9 insertions, 39 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 3032a2f1..695c3bec 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -33,9 +33,6 @@ class BaseCmdLineTest(CoverageTest): ignore_errors=None, include=None, omit=None, morfs=[], show_missing=None, ) - defaults.start( - main_module=None, - ) defaults.xml_report( ignore_errors=None, include=None, omit=None, morfs=[], outfile=None, ) @@ -475,7 +472,7 @@ class CmdLineTest(BaseCmdLineTest): self.cmd_executes("run -m mymodule", """\ .coverage() .erase() - .start(main_module='mymodule') + .start() .run_python_module('mymodule', ['mymodule']) .stop() .save() @@ -483,7 +480,7 @@ class CmdLineTest(BaseCmdLineTest): self.cmd_executes("run -m mymodule -qq arg1 arg2", """\ .coverage() .erase() - .start(main_module='mymodule') + .start() .run_python_module('mymodule', ['mymodule', '-qq', 'arg1', 'arg2']) .stop() .save() @@ -491,7 +488,7 @@ class CmdLineTest(BaseCmdLineTest): self.cmd_executes("run --branch -m mymodule", """\ .coverage(branch=True) .erase() - .start(main_module='mymodule') + .start() .run_python_module('mymodule', ['mymodule']) .stop() .save() diff --git a/tests/test_files.py b/tests/test_files.py index d72788c4..f6976a81 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -101,42 +101,15 @@ class MatcherTest(CoverageTest): ('yourmain', False), ] modules = ['test', 'py.test', 'mymain'] - for mm in ( - ModuleMatcher(modules), - ModuleMatcher(modules, main_module=None), - ModuleMatcher(modules, main_module='yourmain'), - ): - self.assertEqual( - mm.info(), - ['main_module=%r' % mm.main_module] + modules - ) - for modulename, matches in matches_to_try: - self.assertEqual( - mm.match(modulename), - modulename if matches else False, - modulename, - ) - - def test_module_matcher_dunder_main(self): - matches_to_try = [ - ('__main__', True), - ('mymain', True), - ('yourmain', False), - ] - modules = ['test', 'py.test', 'mymain'] - mm = ModuleMatcher(modules, main_module='mymain') - self.assertEqual(mm.info(), ["main_module='mymain'"] + modules) + mm = ModuleMatcher(modules) + self.assertEqual( + mm.info(), + modules + ) for modulename, matches in matches_to_try: - if not matches: - expected = False - elif modulename == '__main__': - expected = mm.main_module - else: - expected = modulename - self.assertEqual( mm.match(modulename), - expected, + matches, modulename, ) |