From b6db3f9bc9932ea4824026a0ad3663242e926769 Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 14 Apr 2021 23:25:22 -0400 Subject: [PATCH] Fixing linter issues as well as issues with the newer versio of python --- tests/conftest.py | 7 +++++-- tests/constants.py | 1 - tests/test_data/fake-editables.json | 2 +- .../test_data/packages/fake_with_local_files/setup.py | 6 +++--- tests/test_resolver.py | 10 ++++++---- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 458a0996a..a0b87cc29 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -43,8 +43,11 @@ def __init__(self): with open("tests/test_data/fake-editables.json") as f: self.editables = json.load(f) - self.editables[eval(self.editables['func'])] = [] - print(self.editables) + self.editables[ + self.editables["fake_with_local_files"].format( + os.path.join(PACKAGES_PATH) + ) + ] = [] def get_hashes(self, ireq): # Some fake hashes diff --git a/tests/constants.py b/tests/constants.py index 62daf3b9b..fa302be95 100644 --- a/tests/constants.py +++ b/tests/constants.py @@ -4,4 +4,3 @@ MINIMAL_WHEELS_PATH = os.path.join(TEST_DATA_PATH, "minimal_wheels") PACKAGES_PATH = os.path.join(TEST_DATA_PATH, "packages") NON_LINKED_PACKAGES_PATH = os.path.join(TEST_DATA_PATH, "non_linked_wheel_file") - diff --git a/tests/test_data/fake-editables.json b/tests/test_data/fake-editables.json index 4fad95278..36937204f 100644 --- a/tests/test_data/fake-editables.json +++ b/tests/test_data/fake-editables.json @@ -1,5 +1,5 @@ { "git+git://example.org/django.git#egg=django": [], "git+https://github.com/celery/billiard#egg=billiard==3.5.9999": [], - "func" : "\"file://localhost/{}/fake_with_local_files/setup.py\".format(os.path.join(PACKAGES_PATH))" + "fake_with_local_files": "file://localhost/{}/fake_with_local_files/setup.py" } diff --git a/tests/test_data/packages/fake_with_local_files/setup.py b/tests/test_data/packages/fake_with_local_files/setup.py index e68b6e4a2..41c4eac46 100644 --- a/tests/test_data/packages/fake_with_local_files/setup.py +++ b/tests/test_data/packages/fake_with_local_files/setup.py @@ -1,15 +1,15 @@ import os + from setuptools import setup + from .constants import NON_LINKED_PACKAGES_PATH setup( name="fake with local files as dependencies", version=0.1, install_requires=[ - 'fake_package_a @ file://localhost/{}/fake_package_a-0.1-py2.py3-none-any.whl'.format( + "fake_package_a @ file://localhost/{}/fake_package_a-0.1-py2.py3-none-any.whl".format( os.path.join(NON_LINKED_PACKAGES_PATH) ) ], ) - - diff --git a/tests/test_resolver.py b/tests/test_resolver.py index c957facf9..7dda6276d 100644 --- a/tests/test_resolver.py +++ b/tests/test_resolver.py @@ -1,8 +1,10 @@ import os + import pytest from piptools.exceptions import NoCandidateFound from piptools.resolver import RequirementSummary, combine_install_requirements + from .constants import PACKAGES_PATH @@ -27,13 +29,13 @@ "fake_package_a @ file://localhost/{}/fake_with_local_files/setup.py".format( os.path.join(PACKAGES_PATH) ) - ], + ], [ - "fake_package_a@ file://localhost/{}/fake_with_local_files/setup.py "\ - "from file://localhost/{}/fake_with_local_files/setup.py".format( + "fake_package_a@ file://localhost/{}/fake_with_local_files/setup.py " + "from file://localhost/{}/fake_with_local_files/setup.py".format( os.path.join(PACKAGES_PATH), os.path.join(PACKAGES_PATH) ) - ] + ], ), (["Jinja2", "markupsafe"], ["jinja2==2.7.3", "markupsafe==0.23"]), # We should return a normal release version if prereleases is False