Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures (mostly ModuleNotFoundError) with .tox being a symlink #777

Closed
blueyed opened this issue Feb 21, 2019 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@blueyed
Copy link
Contributor

blueyed commented Feb 21, 2019

I am seeing the following test failures locally (master, 8802863):

A lot of them appear to be about ModuleNotFoundError and/or different sys.path.

Also happens with tox -e py36.

% tox -e py37 -- --lf
py37 develop-inst-noop: …/Vcs/coveragepy
py37 installed: apipkg==1.5,atomicwrites==1.3.0,attrs==18.2.0,-e git://github.com/nedbat/coveragepy.git@880286348b0ea97dc12e443a3a2f97de16d7dbe3#egg=coverage,covtestegg1==0.0.0,decorator==4.3.2,dnspython==1.16.0,eventlet==0.24.1,execnet==1.5.0,flaky==3.4.0,future==0.17.1,greenlet==0.4.15,mock==2.0.0,monotonic==1.5,more-itertools==6.0.0,pbr==5.1.2,pluggy==0.8.1,py==1.7.0,PyContracts==1.8.7,pyparsing==2.3.1,pytest==4.0.2,pytest-forked==1.0.2,pytest-xdist==1.25.0,six==1.12.0,unittest-mixins==1.6
py37 run-test-pre: PYTHONHASHSEED='1764811753'
py37 runtests: commands[0] | python setup.py --quiet clean develop
warning: no previously-included files found matching 'ci/appveyor.token'
no previously-included directories found matching 'doc/_build'
warning: no previously-included files matching '*.py[co]' found anywhere in distribution
py37 runtests: commands[1] | python igor.py zip_mods install_egg remove_extension
py37 runtests: commands[2] | python igor.py test_with_tracer py --lf
=== CPython 3.7.2 with Python tracer (.tox/py37/bin/python) ===
bringing up nodes...
FFFFFFFFFFFF                                                                                                                                                           [100%]
================================================================================== FAILURES ==================================================================================
_________________________________________________________________ MockingProtectionTest.test_os_path_exists __________________________________________________________________
[gw2] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_oddball.MockingProtectionTest testMethod=test_os_path_exists>

    def test_os_path_exists(self):
        # To see if this test still detects the problem, change isolate_module
        # in misc.py to simply return its argument.  It should fail with a
        # StopIteration error.
        self.make_file("bug416.py", """\
            import os.path

            import mock

            @mock.patch('os.path.exists')
            def test_path_exists(mock_exists):
                mock_exists.side_effect = [17]
                print("in test")
                import bug416a
                print(bug416a.foo)
                print(os.path.exists("."))

            test_path_exists()
            """)
        self.make_file("bug416a.py", """\
            print("bug416a.py")
            foo = 23
            """)

        import py_compile
        py_compile.compile("bug416a.py")
        out = self.run_command("coverage run bug416.py")
>       self.assertEqual(out, "in test\nbug416a.py\n23\n17\n")
E       AssertionError: 'Traceback (most recent call last):\n  Fil[333 chars]st\n' != 'in test\nbug416a.py\n23\n17\n'
E       - Traceback (most recent call last):
E       -   File "bug416.py", line 13, in <module>
E       -     test_path_exists()
E       -   File "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/mock/mock.py", line 1305, in patched
E       -     return func(*args, **keywargs)
E       -   File "bug416.py", line 9, in test_path_exists
E       -     import bug416a
E       - ModuleNotFoundError: No module named 'bug416a'
E         in test
E       + bug416a.py
E       + 23
E       + 17

tests/test_oddball.py:599: AssertionError
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
Traceback (most recent call last):
  File "bug416.py", line 13, in <module>
    test_path_exists()
  File "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/mock/mock.py", line 1305, in patched
    return func(*args, **keywargs)
  File "bug416.py", line 9, in test_path_exists
    import bug416a
ModuleNotFoundError: No module named 'bug416a'
in test

_________________________________________________________________ PluginTest.test_local_files_are_importable _________________________________________________________________
[gw0] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_plugins.PluginTest testMethod=test_local_files_are_importable>

    def test_local_files_are_importable(self):
        self.make_file("importing_plugin.py", """\
            from coverage import CoveragePlugin
            import local_module
            class MyPlugin(CoveragePlugin):
                pass
            def coverage_init(reg, options):
                reg.add_noop(MyPlugin())
            """)
        self.make_file("local_module.py", "CONST = 1")
        self.make_file(".coveragerc", """\
            [run]
            plugins = importing_plugin
            """)
        self.make_file("main_file.py", "print('MAIN')")

        out = self.run_command("coverage run main_file.py")
>       self.assertEqual(out, "MAIN\n")
E       AssertionError: 'Traceback (most recent call last):\n  Fil[941 chars]\'\n' != 'MAIN\n'
E       + MAIN
E       - Traceback (most recent call last):
E       -   File "…/Vcs/coveragepy/.tox/py37/bin/coverage", line 11, in <module>
E       -     load_entry_point('coverage', 'console_scripts', 'coverage')()
E       -   File "…/Vcs/coveragepy/coverage/cmdline.py", line 762, in main
E       -     status = CoverageScript().command_line(argv)
E       -   File "…/Vcs/coveragepy/coverage/cmdline.py", line 506, in command_line
E       -     return self.do_run(options, args)
E       -   File "…/Vcs/coveragepy/coverage/cmdline.py", line 639, in do_run
E       -     self.coverage.start()
E       -   File "…/Vcs/coveragepy/coverage/control.py", line 430, in start
E       -     self._init()
E       -   File "…/Vcs/coveragepy/coverage/control.py", line 207, in _init
E       -     self._plugins = Plugins.load_plugins(self.config.plugins, self.config, self._debug)
E       -   File "…/Vcs/coveragepy/coverage/plugin_support.py", line 40, in load_plugins
E       -     __import__(module)
E       - ModuleNotFoundError: No module named 'importing_plugin'

tests/test_plugins.py:252: AssertionError
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
Traceback (most recent call last):
  File "…/Vcs/coveragepy/.tox/py37/bin/coverage", line 11, in <module>
    load_entry_point('coverage', 'console_scripts', 'coverage')()
  File "…/Vcs/coveragepy/coverage/cmdline.py", line 762, in main
    status = CoverageScript().command_line(argv)
  File "…/Vcs/coveragepy/coverage/cmdline.py", line 506, in command_line
    return self.do_run(options, args)
  File "…/Vcs/coveragepy/coverage/cmdline.py", line 639, in do_run
    self.coverage.start()
  File "…/Vcs/coveragepy/coverage/control.py", line 430, in start
    self._init()
  File "…/Vcs/coveragepy/coverage/control.py", line 207, in _init
    self._plugins = Plugins.load_plugins(self.config.plugins, self.config, self._debug)
  File "…/Vcs/coveragepy/coverage/plugin_support.py", line 40, in load_plugins
    __import__(module)
ModuleNotFoundError: No module named 'importing_plugin'

__________________________________________________________ HtmlTest.test_extensionless_file_collides_with_extension __________________________________________________________
[gw1] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_html.HtmlTest testMethod=test_extensionless_file_collides_with_extension>

    def test_extensionless_file_collides_with_extension(self):
        # It used to be that "program" and "program.py" would both be reported
        # to "program.html".  Now they are not.
        # https://bitbucket.org/ned/coveragepy/issue/69
        self.make_file("program", "import program\n")
        self.make_file("program.py", "a = 1\n")
        self.run_command("coverage run program")
        self.run_command("coverage html")
        self.assert_exists("htmlcov/index.html")
        self.assert_exists("htmlcov/program.html")
>       self.assert_exists("htmlcov/program_py.html")

tests/test_html.py:445:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/coveragetest.py:351: in assert_exists
    self.assertTrue(os.path.exists(fname), msg)
E   AssertionError: False is not true : File 'htmlcov/program_py.html' should exist
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
Traceback (most recent call last):
  File "program", line 1, in <module>
    import program
ModuleNotFoundError: No module named 'program'


_________________________________________________________ EnvironmentTest.test_coverage_run_far_away_is_like_python __________________________________________________________
[gw2] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_process.EnvironmentTest testMethod=test_coverage_run_far_away_is_like_python>

    def test_coverage_run_far_away_is_like_python(self):
        with open(TRY_EXECFILE) as f:
            self.make_file("sub/overthere/prog.py", f.read())
        expected = self.run_command("python sub/overthere/prog.py")
        actual = self.run_command("coverage run sub/overthere/prog.py")
>       self.assert_tryexecfile_output(expected, actual)

tests/test_process.py:869:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_process.py:855: in assert_tryexecfile_output
    self.assertMultiLineEqual(expected, actual)
E   AssertionError: '{\n [2791 chars]/tmp/coverage_test/tests_test_process_Environm[657 chars]n}\n' != '{\n [2791 chars]/tmp/tox…/Vcs/coveragepy/py37/bin",[583 chars]n}\n'
E     {
E         "DATA": "xyzzy",
E         "FN_VAL": "my_fn('fooey')",
E         "__builtins__.dir": [
E             "ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
E             "DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
E             "GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
E             "KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
E             "OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
E             "StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
E             "UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
E             "ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
E             "abs all any ascii bin bool breakpoint bytearray bytes",
E             "callable chr classmethod compile complex copyright credits delattr dict dir divmod",
E             "enumerate eval exec exit filter float format frozenset getattr globals",
E             "hasattr hash help hex id input int isinstance issubclass iter",
E             "len license list locals map max memoryview min next object oct open ord",
E             "pow print property quit range repr reversed round",
E             "set setattr slice sorted staticmethod str sum super tuple type vars zip"
E         ],
E         "__builtins__.has_open": true,
E         "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
E         "__file__": "sub/overthere/prog.py",
E         "__loader__ exists": true,
E         "__loader__.fullname": "__main__",
E         "__main__.DATA": "xyzzy",
E         "__name__": "__main__",
E         "__package__": null,
E         "argv0": "sub/overthere/prog.py",
E         "argv1-n": [],
E         "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_far_away_is_like_python_28970224",
E         "path": [
E   -         "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_far_away_is_like_python_28970224/sub/overthere",
E   +         "/tmp/tox…/Vcs/coveragepy/py37/bin",
E             "…/Vcs/coveragepy/tests/modules",
E             "…/Vcs/coveragepy/tests/zipmods.zip",
E             "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
E             "/usr/lib64/python3.7",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
E             "…/Vcs/coveragepy",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
E         ]
E     }
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
{
    "DATA": "xyzzy",
    "FN_VAL": "my_fn('fooey')",
    "__builtins__.dir": [
        "ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
        "DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
        "GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
        "KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
        "OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
        "StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
        "UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
        "ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
        "abs all any ascii bin bool breakpoint bytearray bytes",
        "callable chr classmethod compile complex copyright credits delattr dict dir divmod",
        "enumerate eval exec exit filter float format frozenset getattr globals",
        "hasattr hash help hex id input int isinstance issubclass iter",
        "len license list locals map max memoryview min next object oct open ord",
        "pow print property quit range repr reversed round",
        "set setattr slice sorted staticmethod str sum super tuple type vars zip"
    ],
    "__builtins__.has_open": true,
    "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
    "__file__": "sub/overthere/prog.py",
    "__loader__ exists": true,
    "__loader__.fullname": "__main__",
    "__main__.DATA": "xyzzy",
    "__name__": "__main__",
    "__package__": null,
    "argv0": "sub/overthere/prog.py",
    "argv1-n": [],
    "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_far_away_is_like_python_28970224",
    "path": [
        "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_far_away_is_like_python_28970224/sub/overthere",
        "…/Vcs/coveragepy/tests/modules",
        "…/Vcs/coveragepy/tests/zipmods.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
        "/usr/lib64/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
        "…/Vcs/coveragepy",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
    ]
}

{
    "DATA": "xyzzy",
    "FN_VAL": "my_fn('fooey')",
    "__builtins__.dir": [
        "ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
        "DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
        "GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
        "KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
        "OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
        "StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
        "UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
        "ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
        "abs all any ascii bin bool breakpoint bytearray bytes",
        "callable chr classmethod compile complex copyright credits delattr dict dir divmod",
        "enumerate eval exec exit filter float format frozenset getattr globals",
        "hasattr hash help hex id input int isinstance issubclass iter",
        "len license list locals map max memoryview min next object oct open ord",
        "pow print property quit range repr reversed round",
        "set setattr slice sorted staticmethod str sum super tuple type vars zip"
    ],
    "__builtins__.has_open": true,
    "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
    "__file__": "sub/overthere/prog.py",
    "__loader__ exists": true,
    "__loader__.fullname": "__main__",
    "__main__.DATA": "xyzzy",
    "__name__": "__main__",
    "__package__": null,
    "argv0": "sub/overthere/prog.py",
    "argv1-n": [],
    "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_far_away_is_like_python_28970224",
    "path": [
        "/tmp/tox…/Vcs/coveragepy/py37/bin",
        "…/Vcs/coveragepy/tests/modules",
        "…/Vcs/coveragepy/tests/zipmods.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
        "/usr/lib64/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
        "…/Vcs/coveragepy",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
    ]
}

______________________________________________________________ EnvironmentTest.test_coverage_run_is_like_python ______________________________________________________________
[gw0] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_process.EnvironmentTest testMethod=test_coverage_run_is_like_python>

    def test_coverage_run_is_like_python(self):
        with open(TRY_EXECFILE) as f:
            self.make_file("run_me.py", f.read())
        expected = self.run_command("python run_me.py")
        actual = self.run_command("coverage run run_me.py")
>       self.assert_tryexecfile_output(expected, actual)

tests/test_process.py:862:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_process.py:855: in assert_tryexecfile_output
    self.assertMultiLineEqual(expected, actual)
E   AssertionError: '{\n [2758 chars]/tmp/coverage_test/tests_test_process_Environm[634 chars]n}\n' != '{\n [2758 chars]/tmp/tox…/Vcs/coveragepy/py37/bin",[583 chars]n}\n'
E     {
E         "DATA": "xyzzy",
E         "FN_VAL": "my_fn('fooey')",
E         "__builtins__.dir": [
E             "ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
E             "DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
E             "GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
E             "KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
E             "OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
E             "StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
E             "UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
E             "ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
E             "abs all any ascii bin bool breakpoint bytearray bytes",
E             "callable chr classmethod compile complex copyright credits delattr dict dir divmod",
E             "enumerate eval exec exit filter float format frozenset getattr globals",
E             "hasattr hash help hex id input int isinstance issubclass iter",
E             "len license list locals map max memoryview min next object oct open ord",
E             "pow print property quit range repr reversed round",
E             "set setattr slice sorted staticmethod str sum super tuple type vars zip"
E         ],
E         "__builtins__.has_open": true,
E         "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
E         "__file__": "run_me.py",
E         "__loader__ exists": true,
E         "__loader__.fullname": "__main__",
E         "__main__.DATA": "xyzzy",
E         "__name__": "__main__",
E         "__package__": null,
E         "argv0": "run_me.py",
E         "argv1-n": [],
E         "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_is_like_python_62748114",
E         "path": [
E   -         "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_is_like_python_62748114",
E   +         "/tmp/tox…/Vcs/coveragepy/py37/bin",
E             "…/Vcs/coveragepy/tests/modules",
E             "…/Vcs/coveragepy/tests/zipmods.zip",
E             "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
E             "/usr/lib64/python3.7",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
E             "…/Vcs/coveragepy",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
E         ]
E     }
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
{
    "DATA": "xyzzy",
    "FN_VAL": "my_fn('fooey')",
    "__builtins__.dir": [
        "ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
        "DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
        "GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
        "KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
        "OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
        "StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
        "UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
        "ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
        "abs all any ascii bin bool breakpoint bytearray bytes",
        "callable chr classmethod compile complex copyright credits delattr dict dir divmod",
        "enumerate eval exec exit filter float format frozenset getattr globals",
        "hasattr hash help hex id input int isinstance issubclass iter",
        "len license list locals map max memoryview min next object oct open ord",
        "pow print property quit range repr reversed round",
        "set setattr slice sorted staticmethod str sum super tuple type vars zip"
    ],
    "__builtins__.has_open": true,
    "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
    "__file__": "run_me.py",
    "__loader__ exists": true,
    "__loader__.fullname": "__main__",
    "__main__.DATA": "xyzzy",
    "__name__": "__main__",
    "__package__": null,
    "argv0": "run_me.py",
    "argv1-n": [],
    "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_is_like_python_62748114",
    "path": [
        "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_is_like_python_62748114",
        "…/Vcs/coveragepy/tests/modules",
        "…/Vcs/coveragepy/tests/zipmods.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
        "/usr/lib64/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
        "…/Vcs/coveragepy",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
    ]
}

{
    "DATA": "xyzzy",
    "FN_VAL": "my_fn('fooey')",
    "__builtins__.dir": [
        "ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
        "DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
        "GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
        "KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
        "OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
        "StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
        "UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
        "ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
        "abs all any ascii bin bool breakpoint bytearray bytes",
        "callable chr classmethod compile complex copyright credits delattr dict dir divmod",
        "enumerate eval exec exit filter float format frozenset getattr globals",
        "hasattr hash help hex id input int isinstance issubclass iter",
        "len license list locals map max memoryview min next object oct open ord",
        "pow print property quit range repr reversed round",
        "set setattr slice sorted staticmethod str sum super tuple type vars zip"
    ],
    "__builtins__.has_open": true,
    "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
    "__file__": "run_me.py",
    "__loader__ exists": true,
    "__loader__.fullname": "__main__",
    "__main__.DATA": "xyzzy",
    "__name__": "__main__",
    "__package__": null,
    "argv0": "run_me.py",
    "argv1-n": [],
    "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_is_like_python_62748114",
    "path": [
        "/tmp/tox…/Vcs/coveragepy/py37/bin",
        "…/Vcs/coveragepy/tests/modules",
        "…/Vcs/coveragepy/tests/zipmods.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
        "/usr/lib64/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
        "…/Vcs/coveragepy",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
    ]
}

__________________________________________________________ EnvironmentTest.test_coverage_run_dir_is_like_python_dir __________________________________________________________
[gw1] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_process.EnvironmentTest testMethod=test_coverage_run_dir_is_like_python_dir>

    def test_coverage_run_dir_is_like_python_dir(self):
        if env.PYVERSION == (3, 5, 4, 'final', 0):       # pragma: obscure
            self.skipTest("3.5.4 broke this: https://bugs.python.org/issue32551")
        with open(TRY_EXECFILE) as f:
            self.make_file("with_main/__main__.py", f.read())

        expected = self.run_command("python with_main")
        actual = self.run_command("coverage run with_main")

        # The coverage.py results are not identical to the Python results, and
        # I don't know why.  For now, ignore those failures. If someone finds
        # a real problem with the discrepancies, we can work on it some more.
        ignored = r"__file__|__loader__|__package__"
        # PyPy includes the current directory in the path when running a
        # directory, while CPython and coverage.py do not.  Exclude that from
        # the comparison also...
        if env.PYPY:
            ignored += "|"+re.escape(os.getcwd())
        expected = re_lines(expected, ignored, match=False)
        actual = re_lines(actual, ignored, match=False)
>       self.assert_tryexecfile_output(expected, actual)

tests/test_process.py:897:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_process.py:855: in assert_tryexecfile_output
    self.assertMultiLineEqual(expected, actual)
E   AssertionError: '{\n [2498 chars]    "with_main",\n        "…/Vcs/co[553 chars]n}\n' != '{\n [2498 chars]    "/tmp/tox…/Vcs/coveragepy/py37/[588 chars]n}\n'
E     {
E         "DATA": "xyzzy",
E         "FN_VAL": "my_fn('fooey')",
E         "__builtins__.dir": [
E             "ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
E             "DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
E             "GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
E             "KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
E             "OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
E             "StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
E             "UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
E             "abs all any ascii bin bool breakpoint bytearray bytes",
E             "callable chr classmethod compile complex copyright credits delattr dict dir divmod",
E             "enumerate eval exec exit filter float format frozenset getattr globals",
E             "hasattr hash help hex id input int isinstance issubclass iter",
E             "len license list locals map max memoryview min next object oct open ord",
E             "pow print property quit range repr reversed round",
E             "set setattr slice sorted staticmethod str sum super tuple type vars zip"
E         ],
E         "__builtins__.has_open": true,
E         "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
E         "__main__.DATA": "xyzzy",
E         "__name__": "__main__",
E         "argv0": "with_main",
E         "argv1-n": [],
E         "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_dir_is_like_python_dir_52421495",
E         "path": [
E   -         "with_main",
E   +         "/tmp/tox…/Vcs/coveragepy/py37/bin",
E             "…/Vcs/coveragepy/tests/modules",
E             "…/Vcs/coveragepy/tests/zipmods.zip",
E             "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
E             "/usr/lib64/python3.7",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
E             "…/Vcs/coveragepy",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
E         ]
E     }
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
{
    "DATA": "xyzzy",
    "FN_VAL": "my_fn('fooey')",
    "__builtins__.dir": [
        "ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
        "DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
        "GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
        "KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
        "OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
        "StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
        "UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
        "ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
        "abs all any ascii bin bool breakpoint bytearray bytes",
        "callable chr classmethod compile complex copyright credits delattr dict dir divmod",
        "enumerate eval exec exit filter float format frozenset getattr globals",
        "hasattr hash help hex id input int isinstance issubclass iter",
        "len license list locals map max memoryview min next object oct open ord",
        "pow print property quit range repr reversed round",
        "set setattr slice sorted staticmethod str sum super tuple type vars zip"
    ],
    "__builtins__.has_open": true,
    "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
    "__file__": "with_main/__main__.py",
    "__loader__ exists": true,
    "__loader__.fullname": "__main__",
    "__main__.DATA": "xyzzy",
    "__name__": "__main__",
    "__package__": "",
    "argv0": "with_main",
    "argv1-n": [],
    "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_dir_is_like_python_dir_52421495",
    "path": [
        "with_main",
        "…/Vcs/coveragepy/tests/modules",
        "…/Vcs/coveragepy/tests/zipmods.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
        "/usr/lib64/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
        "…/Vcs/coveragepy",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
    ]
}

{
    "DATA": "xyzzy",
    "FN_VAL": "my_fn('fooey')",
    "__builtins__.dir": [
        "ArithmeticError AssertionError AttributeError BaseException BlockingIOError BrokenPipeError BufferError BytesWarning ChildProcessError ConnectionAbortedError ConnectionError ConnectionRefusedError ConnectionResetError",
        "DeprecationWarning EOFError Ellipsis EnvironmentError Exception False FileExistsError FileNotFoundError FloatingPointError FutureWarning",
        "GeneratorExit IOError ImportError ImportWarning IndentationError IndexError InterruptedError IsADirectoryError",
        "KeyError KeyboardInterrupt LookupError MemoryError ModuleNotFoundError NameError None NotADirectoryError NotImplemented NotImplementedError",
        "OSError OverflowError PendingDeprecationWarning PermissionError ProcessLookupError RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning",
        "StopAsyncIteration StopIteration SyntaxError SyntaxWarning SystemError SystemExit TabError TimeoutError True TypeError",
        "UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError UnicodeTranslateError UnicodeWarning UserWarning",
        "ValueError Warning ZeroDivisionError __build_class__ __debug__ __doc__ __import__ __loader__ __name__ __package__ __spec__",
        "abs all any ascii bin bool breakpoint bytearray bytes",
        "callable chr classmethod compile complex copyright credits delattr dict dir divmod",
        "enumerate eval exec exit filter float format frozenset getattr globals",
        "hasattr hash help hex id input int isinstance issubclass iter",
        "len license list locals map max memoryview min next object oct open ord",
        "pow print property quit range repr reversed round",
        "set setattr slice sorted staticmethod str sum super tuple type vars zip"
    ],
    "__builtins__.has_open": true,
    "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
    "__file__": "with_main/__main__.py",
    "__loader__ exists": true,
    "__loader__.fullname": "__main__",
    "__main__.DATA": "xyzzy",
    "__name__": "__main__",
    "__package__": null,
    "argv0": "with_main",
    "argv1-n": [],
    "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_dir_is_like_python_dir_52421495",
    "path": [
        "/tmp/tox…/Vcs/coveragepy/py37/bin",
        "…/Vcs/coveragepy/tests/modules",
        "…/Vcs/coveragepy/tests/zipmods.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
        "/usr/lib64/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
        "…/Vcs/coveragepy",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
    ]
}

_____________________________________________________________________ SummaryTest.test_report_precision ______________________________________________________________________
[gw0] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_summary.SummaryTest testMethod=test_report_precision>

    def test_report_precision(self):
        self.make_file(".coveragerc", """\
            [report]
            precision = 3
            omit = */site-packages/*
            """)
        self.make_file("main.py", """
            import not_covered, covered

            def normal(z):
                if z:
                    print("z")
            normal(True)
            normal(False)
            """)
        self.make_file("not_covered.py", """
            def not_covered(n):
                if n:
                    print("n")
            not_covered(True)
            """)
        self.make_file("covered.py", """
            def foo():
                pass
            foo()
            """)
        out = self.run_command("coverage run --branch main.py")
>       self.assertEqual(out, "n\nz\n")
E       AssertionError: 'Traceback (most recent call last):\n  Fil[117 chars]\'\n' != 'n\nz\n'
E       + n
E       + z
E       - Traceback (most recent call last):
E       -   File "main.py", line 2, in <module>
E       -     import not_covered, covered
E       - ModuleNotFoundError: No module named 'not_covered'

tests/test_summary.py:464: AssertionError
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import not_covered, covered
ModuleNotFoundError: No module named 'not_covered'

_____________________________________________________ EnvironmentTest.test_coverage_run_script_imports_doubledashsource ______________________________________________________
[gw2] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_process.EnvironmentTest testMethod=test_coverage_run_script_imports_doubledashsource>

    def test_coverage_run_script_imports_doubledashsource(self):
        # This file imports try_execfile, which compiles it to .pyc, so the
        # first run will have __file__ == "try_execfile.py" and the second will
        # have __file__ == "try_execfile.pyc", which throws off the comparison.
        # Setting dont_write_bytecode True stops the compilation to .pyc and
        # keeps the test working.
        self.make_file("myscript", """\
            import sys; sys.dont_write_bytecode = True
            import process_test.try_execfile
            """)

        expected = self.run_command("python myscript")
        actual = self.run_command("coverage run --source process_test myscript")
>       self.assert_tryexecfile_output(expected, actual)

tests/test_process.py:949:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_process.py:855: in assert_tryexecfile_output
    self.assertMultiLineEqual(expected, actual)
E   AssertionError: '{\n [1571 chars]/tmp/coverage_test/tests_test_process_Environm[651 chars]n}\n' != '{\n [1571 chars]/tmp/tox…/Vcs/coveragepy/py37/bin",[583 chars]n}\n'
E     {
E         "DATA": "xyzzy",
E         "FN_VAL": "my_fn('fooey')",
E         "__builtins__.dir": [
E             "__class__ __contains__ __delattr__ __delitem__ __dir__ __doc__ __eq__ __format__ __ge__ __getattribute__ __getitem__ __gt__ __hash__ __init__ __init_subclass__ __iter__ __le__ __len__ __lt__ __ne__ __new__ __reduce__ __reduce_ex__ __repr__ __setattr__ __setitem__ __sizeof__ __str__ __subclasshook__",
E             "clear copy",
E             "fromkeys get",
E             "items",
E             "keys",
E             "pop popitem",
E             "setdefault update values"
E         ],
E         "__builtins__.has_open": false,
E         "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
E         "__file__": "…/Vcs/coveragepy/tests/modules/process_test/try_execfile.py",
E         "__loader__ exists": true,
E         "__loader__.fullname": "process_test.try_execfile",
E         "__main__.DATA": "nothing",
E         "__name__": "process_test.try_execfile",
E         "__package__": "process_test",
E         "argv0": "myscript",
E         "argv1-n": [],
E         "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_script_imports_doubledashsource_47387272",
E         "path": [
E   -         "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_script_imports_doubledashsource_47387272",
E   +         "/tmp/tox…/Vcs/coveragepy/py37/bin",
E             "…/Vcs/coveragepy/tests/modules",
E             "…/Vcs/coveragepy/tests/zipmods.zip",
E             "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
E             "/usr/lib64/python3.7",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
E             "…/Vcs/coveragepy",
E             "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
E         ]
E     }
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
{
    "DATA": "xyzzy",
    "FN_VAL": "my_fn('fooey')",
    "__builtins__.dir": [
        "__class__ __contains__ __delattr__ __delitem__ __dir__ __doc__ __eq__ __format__ __ge__ __getattribute__ __getitem__ __gt__ __hash__ __init__ __init_subclass__ __iter__ __le__ __len__ __lt__ __ne__ __new__ __reduce__ __reduce_ex__ __repr__ __setattr__ __setitem__ __sizeof__ __str__ __subclasshook__",
        "clear copy",
        "fromkeys get",
        "items",
        "keys",
        "pop popitem",
        "setdefault update values"
    ],
    "__builtins__.has_open": false,
    "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
    "__file__": "…/Vcs/coveragepy/tests/modules/process_test/try_execfile.py",
    "__loader__ exists": true,
    "__loader__.fullname": "process_test.try_execfile",
    "__main__.DATA": "nothing",
    "__name__": "process_test.try_execfile",
    "__package__": "process_test",
    "argv0": "myscript",
    "argv1-n": [],
    "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_script_imports_doubledashsource_47387272",
    "path": [
        "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_script_imports_doubledashsource_47387272",
        "…/Vcs/coveragepy/tests/modules",
        "…/Vcs/coveragepy/tests/zipmods.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
        "/usr/lib64/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
        "…/Vcs/coveragepy",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
    ]
}

{
    "DATA": "xyzzy",
    "FN_VAL": "my_fn('fooey')",
    "__builtins__.dir": [
        "__class__ __contains__ __delattr__ __delitem__ __dir__ __doc__ __eq__ __format__ __ge__ __getattribute__ __getitem__ __gt__ __hash__ __init__ __init_subclass__ __iter__ __le__ __len__ __lt__ __ne__ __new__ __reduce__ __reduce_ex__ __repr__ __setattr__ __setitem__ __sizeof__ __str__ __subclasshook__",
        "clear copy",
        "fromkeys get",
        "items",
        "keys",
        "pop popitem",
        "setdefault update values"
    ],
    "__builtins__.has_open": false,
    "__doc__": "Test file for run_python_file.\n\nThis file is executed two ways::\n\n    $ coverage run try_execfile.py\n\nand::\n\n    $ python try_execfile.py\n\nThe output is compared to see that the program execution context is the same\nunder coverage and under Python.\n\nIt is not crucial that the execution be identical, there are some differences\nthat are OK.  This program canonicalizes the output to gloss over those\ndifferences and get a clean diff.\n\n",
    "__file__": "…/Vcs/coveragepy/tests/modules/process_test/try_execfile.py",
    "__loader__ exists": true,
    "__loader__.fullname": "process_test.try_execfile",
    "__main__.DATA": "nothing",
    "__name__": "process_test.try_execfile",
    "__package__": "process_test",
    "argv0": "myscript",
    "argv1-n": [],
    "os.getcwd": "/tmp/coverage_test/tests_test_process_EnvironmentTest_test_coverage_run_script_imports_doubledashsource_47387272",
    "path": [
        "/tmp/tox…/Vcs/coveragepy/py37/bin",
        "…/Vcs/coveragepy/tests/modules",
        "…/Vcs/coveragepy/tests/zipmods.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python37.zip",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/lib-dynload",
        "/usr/lib64/python3.7",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages",
        "…/Vcs/coveragepy",
        "…/Vcs/coveragepy/.tox/py37/lib/python3.7/site-packages/covtestegg1-0.0.0-py3.6.egg"
    ]
}

__________________________________________________________ SummaryTest.test_report_show_missing_branches_and_lines ___________________________________________________________
[gw1] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_summary.SummaryTest testMethod=test_report_show_missing_branches_and_lines>

    def test_report_show_missing_branches_and_lines(self):
        self.make_file("main.py", """\
            import mybranch
            """)
        self.make_file("mybranch.py", """\
            def branch(x, y, z):
                if x:
                    print("x")
                if y:
                    print("y")
                if z:
                    if x and y:
                        print("z")
                return x
            branch(1, 1, 0)
            """)
        self.omit_site_packages()
        out = self.run_command("coverage run --branch main.py")
>       self.assertEqual(out, 'x\ny\n')
E       AssertionError: 'Traceback (most recent call last):\n  Fil[102 chars]\'\n' != 'x\ny\n'
E       + x
E       + y
E       - Traceback (most recent call last):
E       -   File "main.py", line 1, in <module>
E       -     import mybranch
E       - ModuleNotFoundError: No module named 'mybranch'

tests/test_summary.py:258: AssertionError
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import mybranch
ModuleNotFoundError: No module named 'mybranch'

_________________________________________________________ SummaryTest.test_report_skip_covered_branches_with_totals __________________________________________________________
[gw0] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_summary.SummaryTest testMethod=test_report_skip_covered_branches_with_totals>

    def test_report_skip_covered_branches_with_totals(self):
        self.make_file("main.py", """
            import not_covered
            import also_not_run

            def normal(z):
                if z:
                    print("z")
            normal(True)
            normal(False)
            """)
        self.make_file("not_covered.py", """
            def not_covered(n):
                if n:
                    print("n")
            not_covered(True)
            """)
        self.make_file("also_not_run.py", """
            def does_not_appear_in_this_film(ni):
                print("Ni!")
            """)
        self.omit_site_packages()
        out = self.run_command("coverage run --branch main.py")
>       self.assertEqual(out, "n\nz\n")
E       AssertionError: 'Traceback (most recent call last):\n  Fil[108 chars]\'\n' != 'n\nz\n'
E       + n
E       + z
E       - Traceback (most recent call last):
E       -   File "main.py", line 2, in <module>
E       -     import not_covered
E       - ModuleNotFoundError: No module named 'not_covered'

tests/test_summary.py:367: AssertionError
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import not_covered
ModuleNotFoundError: No module named 'not_covered'

_______________________________________________________________ SummaryTest.test_report_skip_covered_branches ________________________________________________________________
[gw2] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_summary.SummaryTest testMethod=test_report_skip_covered_branches>

    def test_report_skip_covered_branches(self):
        self.make_file("main.py", """
            import not_covered, covered

            def normal(z):
                if z:
                    print("z")
            normal(True)
            normal(False)
            """)
        self.make_file("not_covered.py", """
            def not_covered(n):
                if n:
                    print("n")
            not_covered(True)
            """)
        self.make_file("covered.py", """
            def foo():
                pass
            foo()
            """)
        self.omit_site_packages()
        out = self.run_command("coverage run --branch main.py")
>       self.assertEqual(out, "n\nz\n")
E       AssertionError: 'Traceback (most recent call last):\n  Fil[117 chars]\'\n' != 'n\nz\n'
E       + n
E       + z
E       - Traceback (most recent call last):
E       -   File "main.py", line 2, in <module>
E       -     import not_covered, covered
E       - ModuleNotFoundError: No module named 'not_covered'

tests/test_summary.py:327: AssertionError
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import not_covered, covered
ModuleNotFoundError: No module named 'not_covered'

______________________________________________________________ SummaryTest.test_report_skip_covered_no_branches ______________________________________________________________
[gw1] linux -- Python 3.7.2 …/Vcs/coveragepy/.tox/py37/bin/python

self = <tests.test_summary.SummaryTest testMethod=test_report_skip_covered_no_branches>

    def test_report_skip_covered_no_branches(self):
        self.make_file("main.py", """
            import not_covered

            def normal():
                print("z")
            normal()
            """)
        self.make_file("not_covered.py", """
            def not_covered():
                print("n")
            """)
        self.omit_site_packages()
        out = self.run_command("coverage run main.py")
>       self.assertEqual(out, "z\n")
E       AssertionError: 'Traceback (most recent call last):\n  Fil[108 chars]\'\n' != 'z\n'
E       + z
E       - Traceback (most recent call last):
E       -   File "main.py", line 2, in <module>
E       -     import not_covered
E       - ModuleNotFoundError: No module named 'not_covered'

tests/test_summary.py:286: AssertionError
---------------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------------
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import not_covered
ModuleNotFoundError: No module named 'not_covered'

========================================================================== short test summary info ===========================================================================
FAIL tests/test_oddball.py::MockingProtectionTest::test_os_path_exists
FAIL tests/test_plugins.py::PluginTest::test_local_files_are_importable
FAIL tests/test_html.py::HtmlTest::test_extensionless_file_collides_with_extension
FAIL tests/test_process.py::EnvironmentTest::test_coverage_run_far_away_is_like_python
FAIL tests/test_process.py::EnvironmentTest::test_coverage_run_is_like_python
FAIL tests/test_process.py::EnvironmentTest::test_coverage_run_dir_is_like_python_dir
FAIL tests/test_summary.py::SummaryTest::test_report_precision
FAIL tests/test_process.py::EnvironmentTest::test_coverage_run_script_imports_doubledashsource
FAIL tests/test_summary.py::SummaryTest::test_report_show_missing_branches_and_lines
FAIL tests/test_summary.py::SummaryTest::test_report_skip_covered_branches_with_totals
FAIL tests/test_summary.py::SummaryTest::test_report_skip_covered_branches
FAIL tests/test_summary.py::SummaryTest::test_report_skip_covered_no_branches
12 failed in 4.54 seconds
ERROR: InvocationError for command '…/Vcs/coveragepy/.tox/py37/bin/python igor.py test_with_tracer py --lf' (exited with code 1)

Tried a fresh checkout, using

@blueyed blueyed added the bug Something isn't working label Feb 21, 2019
@blueyed
Copy link
Contributor Author

blueyed commented Feb 21, 2019

This is due to .tox being a symlink: .tox -> /tmp/tox/home/user/Vcs/coveragepy/.

This appears to change the behavior with run_command("coverage …") in tests.

@blueyed blueyed changed the title Test failures (mostly ModuleNotFoundError) Test failures (mostly ModuleNotFoundError) with .tox being a symlink Feb 21, 2019
@blueyed
Copy link
Contributor Author

blueyed commented Feb 21, 2019

Caused by not using an absolute path with tox's --workdir.
Updated my wrapper at tox-dev/tox#690 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant