예제 #1
0
 def test_parse_requirements(self) -> None:
     """Test parsing requirements file."""
     requirements_path = os.path.join(self.data_dir, "requirements",
                                      "parse_requirements.txt")
     parsed = parse_requirements(requirements_path)
     assert isinstance(parsed, tuple)
     assert len(parsed) == 2
     assert parsed[0] == [
         Source(url="https://pypi.org/simple",
                name="pypi-org",
                verify_ssl=True,
                warehouse=True,
                warehouse_api_url=None),
         Source(
             url="https://tensorflow.pypi.thoth-station.ninja/simple",
             name="tensorflow-pypi-thoth-station-ninja",
             verify_ssl=True,
             warehouse=False,
             warehouse_api_url=None,
         ),
     ]
     assert parsed[1] == [
         PackageVersion(
             name="click",
             version="==7.0",
             develop=False,
             index=None,
             hashes=[
                 "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13"
             ],
             markers=None,
             extras=["cool"],
         ),
         PackageVersion(
             name="flask",
             version="<=1.1.1>0.12",
             develop=False,
             index=None,
             hashes=[
                 "sha256:45eb5a6fd193d6cf7e0cf5d8a5b31f83d5faae0293695626f539a823e93b13f6"
             ],
             markers='python_version >= "2.7"',
         ),
         PackageVersion(
             name="werkzeug",
             version="==0.16.0",
             develop=False,
             index=None,
             hashes=[
                 "sha256:7280924747b5733b246fe23972186c6b348f9ae29724135a6dfc1e53cea433e7"
             ],
             markers=None,
         ),
     ]
예제 #2
0
 def test_parse_requirements_empty(self) -> None:
     """Test parsing requirements file."""
     requirements_path = os.path.join(self.data_dir, "requirements", "parse_requirements_empty.txt")
     assert parse_requirements(requirements_path) == ([], [])