-
-
Notifications
You must be signed in to change notification settings - Fork 463
Closed
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already exists
Description
Reproduce
System
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
File
cov-bug.py
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Generator, List
def recurse_artifacts(artifacts: List[str], root: Path) -> Generator[Path, None, None]:
for artifact in artifacts:
artifact = Path(artifact)
if not artifact.is_absolute():
artifact = root / artifact
if artifact.is_file():
yield artifact
elif artifact.is_dir():
yield from artifact.iterdir()
def main():
with TemporaryDirectory() as d:
project_dir = Path(d).resolve()
build_dir = project_dir / 'dist'
build_dir.mkdir()
absolute_path = project_dir / 'absolute.whl'
absolute_path.touch()
(build_dir / 'test.tar.gz').touch()
(build_dir / 'test.txt').touch()
(build_dir / 'test.whl').touch()
# Turning generator into list also fails:
# for artifact in list(recurse_artifacts(['dist', str(absolute_path)], project_dir)):
for artifact in recurse_artifacts(['dist', str(absolute_path)], project_dir):
if artifact.name.endswith('.whl'):
print('found wheel')
elif artifact.name.endswith('.tar.gz'):
print('found sdist')
else:
# print('skipping')
continue
print('uploading')
if __name__ == '__main__':
main()Command
$ coverage run cov-bug.py && coverage report --show-missing
found sdist
uploading
found wheel
uploading
found wheel
uploading
Name Stmts Miss Cover Missing
------------------------------------------
cov-bug.py 31 1 97% 39
------------------------------------------
TOTAL 31 1 97%
Additional context
The branch is discovered if you uncomment print('skipping')
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already exists