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

process path aliases in run #1027

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

graingert
Copy link
Contributor

No description provided.

@graingert
Copy link
Contributor Author

graingert commented Sep 1, 2020

@nedbat

[coverage:run]
source=.

[coverage:paths]
.
.tox/*/lib/*/site-packages/**

should be able to get coverage to cover any file in .tox/*/lib/*/site-packages/** that matches a file in .

@graingert graingert force-pushed the process-path-aliases-in-run branch 2 times, most recently from dfd952b to 5506bc0 Compare September 1, 2020 22:43
@graingert graingert force-pushed the process-path-aliases-in-run branch from 5506bc0 to 1062d3c Compare September 1, 2020 22:45
```
================================== FAILURES ===================================
________________ UnicodeFilePathsTest.test_accented_directory _________________
[gw1] win32 -- Python 2.7.17 C:\projects\coveragepy\.tox\py27\Scripts\python.EXE
args = (<tests.test_process.UnicodeFilePathsTest testMethod=test_accented_directory>,)
kwargs = {}
    @functools.wraps(method)
    def _wrapper(*args, **kwargs):
        try:
>           result = method(*args, **kwargs)
tests\coveragetest.py:47:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests\test_process.py:1320: in test_accented_directory
    self.assertEqual(out, "accented\n")
E   AssertionError: 'Traceback (most recent call last):\n  File "C:\\projects\\coveragepy\\.tox\\py2 [truncated]... != 'accented\n'
E   + accented
E   - Traceback (most recent call last):
E   -   File "C:\projects\coveragepy\.tox\py27\Scripts\coverage-script.py", line 11, in <module>
E   -     load_entry_point('coverage', 'console_scripts', 'coverage')()
E   -   File "c:\projects\coveragepy\coverage\cmdline.py", line 865, in main
E   -     status = CoverageScript().command_line(argv)
E   -   File "c:\projects\coveragepy\coverage\cmdline.py", line 582, in command_line
E   -     return self.do_run(options, args)
E   -   File "c:\projects\coveragepy\coverage\cmdline.py", line 737, in do_run
E   -     self.coverage.start()
E   -   File "c:\projects\coveragepy\coverage\control.py", line 524, in start
E   -     self._init()
E   -   File "c:\projects\coveragepy\coverage\control.py", line 253, in _init
E   -     self._debug = DebugControl(self.config.debug, self._debug_file)
E   -   File "c:\projects\coveragepy\coverage\debug.py", line 36, in __init__
E   -     def __init__(self, options, output):
E   -   File "c:\projects\coveragepy\coverage\pytracer.py", line 135, in _trace
E   -     disp = self.should_trace(filename, frame)
E   -   File "c:\projects\coveragepy\coverage\control.py", line 315, in _should_trace
E   -     disp = self._inorout.should_trace(filename, frame)
E   -   File "c:\projects\coveragepy\coverage\inorout.py", line 309, in should_trace
E   -     reason = self.check_include_omit_etc(disp.source_filename, frame)
E   -   File "c:\projects\coveragepy\coverage\inorout.py", line 339, in check_include_omit_etc
E   -     if self.source_match.match(filename):
E   -   File "c:\projects\coveragepy\coverage\files.py", line 232, in match
E   -     fpath = self.aliases.map(fpath)
E   -   File "c:\projects\coveragepy\coverage\files.py", line 413, in map
E   -     new = canonical_filename(new)
E   -   File "<decorator-gen-2>", line 2, in canonical_filename
E   -   File "C:\projects\coveragepy\.tox\py27\lib\site-packages\contracts\main.py", line 270, in contracts_checker
E   -     result = function_(*args, **kwargs)
E   -   File "c:\projects\coveragepy\coverage\files.py", line 67, in canonical_filename
E   -     f = os.path.join(path, filename)
E   -   File "c:\python27\lib\ntpath.py", line 85, in join
E   -     result_path = result_path + p_path
E   - UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 124: ordinal not in range(128)
E   - Coverage.py warning: Trace function changed, measurement is likely wrong: None (trace-changed)
---------------------------- Captured stdout call -----------------------------
Traceback (most recent call last):
  File "C:\projects\coveragepy\.tox\py27\Scripts\coverage-script.py", line 11, in <module>
    load_entry_point('coverage', 'console_scripts', 'coverage')()
  File "c:\projects\coveragepy\coverage\cmdline.py", line 865, in main
    status = CoverageScript().command_line(argv)
  File "c:\projects\coveragepy\coverage\cmdline.py", line 582, in command_line
    return self.do_run(options, args)
  File "c:\projects\coveragepy\coverage\cmdline.py", line 737, in do_run
    self.coverage.start()
  File "c:\projects\coveragepy\coverage\control.py", line 524, in start
    self._init()
  File "c:\projects\coveragepy\coverage\control.py", line 253, in _init
    self._debug = DebugControl(self.config.debug, self._debug_file)
  File "c:\projects\coveragepy\coverage\debug.py", line 36, in __init__
    def __init__(self, options, output):
  File "c:\projects\coveragepy\coverage\pytracer.py", line 135, in _trace
    disp = self.should_trace(filename, frame)
  File "c:\projects\coveragepy\coverage\control.py", line 315, in _should_trace
    disp = self._inorout.should_trace(filename, frame)
  File "c:\projects\coveragepy\coverage\inorout.py", line 309, in should_trace
    reason = self.check_include_omit_etc(disp.source_filename, frame)
  File "c:\projects\coveragepy\coverage\inorout.py", line 339, in check_include_omit_etc
    if self.source_match.match(filename):
  File "c:\projects\coveragepy\coverage\files.py", line 232, in match
    fpath = self.aliases.map(fpath)
  File "c:\projects\coveragepy\coverage\files.py", line 413, in map
    new = canonical_filename(new)
  File "<decorator-gen-2>", line 2, in canonical_filename
  File "C:\projects\coveragepy\.tox\py27\lib\site-packages\contracts\main.py", line 270, in contracts_checker
    result = function_(*args, **kwargs)
  File "c:\projects\coveragepy\coverage\files.py", line 67, in canonical_filename
    f = os.path.join(path, filename)
  File "c:\python27\lib\ntpath.py", line 85, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 124: ordinal not in range(128)
Coverage.py warning: Trace function changed, measurement is likely wrong: None (trace-changed)
=========================== short test summary info ===========================
```
@graingert graingert marked this pull request as draft September 3, 2020 09:04
@nedbat nedbat force-pushed the master branch 2 times, most recently from 0c14f1a to 82169a6 Compare June 2, 2022 12:11
@ProsperousHeart
Copy link
Contributor

is this draft still valid?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants