periareon / req-compile

Python requirements compilation
MIT License
14 stars 4 forks source link

Fix `test_source_dist` on Windows #53

Open abrisco opened 8 months ago

abrisco commented 8 months ago

This issue tracks solving the following problem in testing. It's been temporarily disabled but represents a potential bug that should be fixed.

================================== FAILURES ===================================
_____ test_source_dist[newline-req-1.0-newline-req-1.0-reqs33-mock_targz] _____

archive_fixture = 'mock_targz', directory = 'newline-req-1.0'
name = 'newline-req', version = '1.0'
reqs = ['cfn_flip>=1.0.2', 'awacs>=0.8; extra == "policy"']
mock_targz = <function mock_targz.<locals>.build_targz at 0x000001942F0B5A68>
mock_zip = <function mock_zip.<locals>.build_zip at 0x000001942F0B51F8>
mocker = <pytest_mock.plugin.MockerFixture object at 0x000001942EF25508>

    @pytest.mark.parametrize("archive_fixture", ["mock_targz", "mock_zip", "mock_fs"])
>           assert set(metadata.reqs) == set(pkg_resources.parse_requirements(reqs))
E           assert set() == {Requirement....== "policy"')}
E             Extra items in the right set:
E             Requirement.parse('cfn_flip>=1.0.2')
E             Requirement.parse('awacs>=0.8; extra == "policy"')
E             Full diff:
E             + set(,
E             + )
E             - {
E             -  Requirement.parse('awacs>=0.8; extra == "policy"'),
E             -  Requirement.parse('cfn_flip>=1.0.2'),
E             - }

tests\test_metadata.py:200: AssertionError
------------------------------ Captured log call ------------------------------
INFO     req_compile.metadata:metadata.py:35 Extracting metadata for D:\a\req-compile\req-compile\tests\source-packages\newline-req-1.0
DEBUG    req_compile.metadata:metadata.py:73 Extracting directly from a source directory
INFO     req_compile.metadata.source:source.py:113 Attempting to fetch metadata from setup.py
INFO     req_compile.metadata.source:source.py:210 Parsing setup.py setup.py
WARNING  req_compile.metadata.source:source.py:213 Failed to parse newline-req-1.0
Traceback (most recent call last):
  File "D:\a\req-compile\req-compile\req_compile\metadata\source.py", line 211, in _fetch_from_setup_py
    results = _parse_setup_py(name, setup_file, extractor)
  File "D:\a\req-compile\req-compile\req_compile\metadata\source.py", line 812, in _parse_setup_py
    exec(contents, spy_globals, spy_globals)
  File "<string>", line 30, in <module>
  File "D:\a\req-compile\req-compile\req_compile\metadata\source.py", line 436, in setup
    version = utils.parse_version(str(version))
  File "D:\a\req-compile\req-compile\req_compile\utils.py", line 62, in parse_version
    return pkg_resources.parse_version(version)
  File "C:\hostedtoolcache\windows\Python\3.7.9\x64\lib\site-packages\pkg_resources\_vendor\packaging\version.py", line 198, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '1.0''
INFO     req_compile.metadata.source:source.py:353 Building egg info for C:\Users\RUNNER~1\AppData\Local\Temp\tmp_6d3ileh\setup.py