Skip to content

Commit 41dbcd6

Browse files
jobselkomdellweg
authored andcommitted
Merge pull request #877 from jobselko/fix_nightly
Fix tests to account for new fixtures (cherry picked from commit ee1aed2) (cherry picked from commit 7433f61)
1 parent 543e9db commit 41dbcd6

File tree

4 files changed

+73
-51
lines changed

4 files changed

+73
-51
lines changed

CHANGES/876.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed tests to account for new fixtures.

pulp_python/tests/functional/api/test_download_content.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
PYTHON_MD_PROJECT_SPECIFIER,
1515
PYTHON_MD_FIXTURE_SUMMARY,
1616
PYTHON_LG_FIXTURE_SUMMARY,
17+
PYTHON_LG_FIXTURE_PRERELEASES_SUMMARY,
1718
PYTHON_LG_PROJECT_SPECIFIER,
1819
)
1920
from pulp_python.tests.functional.utils import (
@@ -103,21 +104,25 @@ def test_basic_pulp_to_pulp_sync(self):
103104
cfg.get_content_host_base_url(),
104105
"pulp/content",
105106
distro.base_path,
106-
""
107+
"",
107108
]
108109
unit_url = "/".join(url_fragments)
109110

110111
# Sync using old Pulp content api
111112
body["url"] = unit_url
112113
remote = self._create_remote(**body)
113114
repo2 = self._create_repo_and_sync_with_remote(remote)
114-
self.assertEqual(get_content_summary(repo2.to_dict()), PYTHON_LG_FIXTURE_SUMMARY)
115+
self.assertEqual(
116+
get_content_summary(repo2.to_dict()), PYTHON_LG_FIXTURE_SUMMARY
117+
)
115118

116119
# Sync using new PyPI endpoints
117120
body["url"] = distro.base_url
118121
remote = self._create_remote(**body)
119122
repo3 = self._create_repo_and_sync_with_remote(remote)
120-
self.assertEqual(get_content_summary(repo3.to_dict()), PYTHON_LG_FIXTURE_SUMMARY)
123+
self.assertEqual(
124+
get_content_summary(repo3.to_dict()), PYTHON_LG_FIXTURE_SUMMARY
125+
)
121126

122127
def test_full_fixtures_to_pulp_sync(self):
123128
"""
@@ -126,7 +131,9 @@ def test_full_fixtures_to_pulp_sync(self):
126131
"""
127132
remote = self._create_remote(includes=[], prereleases=True)
128133
repo = self._create_repo_and_sync_with_remote(remote)
129-
self.assertEqual(get_content_summary(repo.to_dict()), PYTHON_LG_FIXTURE_SUMMARY)
134+
self.assertEqual(
135+
get_content_summary(repo.to_dict()), PYTHON_LG_FIXTURE_PRERELEASES_SUMMARY
136+
)
130137

131138
def test_full_pulp_to_pulp_sync(self):
132139
"""
@@ -140,12 +147,18 @@ def test_full_pulp_to_pulp_sync(self):
140147

141148
remote = self._create_remote(includes=[], url=distro.base_url)
142149
repo2 = self._create_repo_and_sync_with_remote(remote)
143-
self.assertEqual(get_content_summary(repo2.to_dict()), PYTHON_MD_FIXTURE_SUMMARY)
150+
self.assertEqual(
151+
get_content_summary(repo2.to_dict()), PYTHON_MD_FIXTURE_SUMMARY
152+
)
144153

145154
# Now test using publication simple pages
146155
pub = self._create_publication(repo)
147156
distro2 = self._create_distribution_from_publication(pub)
148-
remote = self._create_remote(includes=[], url=distro2.base_url, prereleases=True)
157+
remote = self._create_remote(
158+
includes=[], url=distro2.base_url, prereleases=True
159+
)
149160

150161
repo3 = self._create_repo_and_sync_with_remote(remote)
151-
self.assertEqual(get_content_summary(repo3.to_dict()), PYTHON_MD_FIXTURE_SUMMARY)
162+
self.assertEqual(
163+
get_content_summary(repo3.to_dict()), PYTHON_MD_FIXTURE_SUMMARY
164+
)

pulp_python/tests/functional/api/test_full_mirror.py

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ def setUpClass(cls):
5050
cls.cfg = config.get_config()
5151
cls.client = gen_python_client()
5252
configuration = Configuration()
53-
configuration.username = 'admin'
54-
configuration.password = 'password'
55-
configuration.host = 'http://{}:24817'.format(socket.gethostname())
56-
configuration.safe_chars_for_path_param = '/'
53+
configuration.username = "admin"
54+
configuration.password = "password"
55+
configuration.host = "http://{}:24817".format(socket.gethostname())
56+
configuration.safe_chars_for_path_param = "/"
5757
cls.core_client = CoreApiClient(configuration)
5858

5959
def test_on_demand_pypi_full_sync(self):
@@ -83,7 +83,9 @@ def test_on_demand_pypi_full_sync(self):
8383
self.assertIsNotNone(repo.latest_version_href)
8484
# As of August 11 2020, all_packages() returns 253,587 packages,
8585
# only 248,677 of them were downloadable
86-
self.assertTrue(get_content_summary(repo.to_dict())[PYTHON_CONTENT_NAME] > 245000)
86+
self.assertTrue(
87+
get_content_summary(repo.to_dict())[PYTHON_CONTENT_NAME] > 245000
88+
)
8789

8890

8991
class PullThroughMirror(TestCaseUsingBindings, TestHelpersMixin):
@@ -108,21 +110,26 @@ def test_pull_through_install(self):
108110
remote = self._create_remote(url=PYPI_URL)
109111
distro = self._create_distribution(remote=remote.pulp_href)
110112

111-
if self.cli_client.run(("pip", "list")).stdout.find("numpy") == -1:
112-
content = self.content_api.list(name="numpy")
113-
self.assertEqual(content.count, 0, msg="numpy content already present in test")
113+
PACKAGE = "shelf-reader"
114+
if self.cli_client.run(("pip", "list")).stdout.find(PACKAGE) == -1:
115+
content = self.content_api.list(name=PACKAGE)
116+
self.assertEqual(
117+
content.count, 0, msg=f"{PACKAGE} content already present in test"
118+
)
114119
host = urlsplit(PULP_CONTENT_BASE_URL).hostname
115120
url = urljoin(self.PYPI_HOST, f"{distro.base_path}/simple/")
116121
out = self.cli_client.run(
117-
("pip", "install", "--trusted-host", host, "-i", url, "numpy")
122+
("pip", "install", "--trusted-host", host, "-i", url, PACKAGE)
118123
)
119124
self.addCleanup(delete_orphans)
120-
self.assertTrue(self.cli_client.run(("pip", "list")).stdout.find("numpy") != -1, out)
121-
self.addCleanup(self.cli_client.run, ("pip", "uninstall", "numpy", "-y"))
122-
content = self.content_api.list(name="numpy")
125+
self.assertTrue(
126+
self.cli_client.run(("pip", "list")).stdout.find(PACKAGE) != -1, out
127+
)
128+
self.addCleanup(self.cli_client.run, ("pip", "uninstall", PACKAGE, "-y"))
129+
content = self.content_api.list(name=PACKAGE)
123130
self.assertEqual(content.count, 1)
124131
else:
125-
self.skipTest("Uninstall numpy before running this test")
132+
self.skipTest(f"Uninstall {PACKAGE} before running this test")
126133

127134
def test_pull_through_simple(self):
128135
"""Tests that the simple page is properly modified when requesting a pull-through."""
@@ -139,14 +146,18 @@ def test_pull_through_simple(self):
139146
relative_path = f"{distro.base_path}/{package.filename}?redirect="
140147
self.assertIn(urljoin(PULP_CONTENT_BASE_URL, relative_path), package.url)
141148
digests = package.get_digests()
142-
self.assertEqual(PYTHON_XS_FIXTURE_CHECKSUMS[package.filename], digests["sha256"])
149+
self.assertEqual(
150+
PYTHON_XS_FIXTURE_CHECKSUMS[package.filename], digests["sha256"]
151+
)
143152

144153
def test_pull_through_with_repo(self):
145154
"""Tests that if content is already in repository, pull-through isn't used."""
146155
remote = self._create_remote()
147156
repo = self._create_repo_and_sync_with_remote(remote)
148157
self.addCleanup(delete_orphans)
149-
distro = self._create_distribution(remote=remote.pulp_href, repository=repo.pulp_href)
158+
distro = self._create_distribution(
159+
remote=remote.pulp_href, repository=repo.pulp_href
160+
)
150161

151162
url = urljoin(self.PYPI_HOST, f"{distro.base_path}/simple/shelf-reader/")
152163
response = requests.get(url)

pulp_python/tests/functional/constants.py

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,15 @@
113113
"aiohttp-3.2.1.tar.gz": "1b95d53f8dac13898f0a3e4af76f6f36d540fbfaefc4f4c9f43e436fa0e53d22",
114114
"aiohttp-3.2.0.tar.gz": "1be3903fe6a36d20492e74efb326522dd4702bf32b45ffc7acbc0fb34ab240a6",
115115
"Django-1.10.4.tar.gz": "fff7f062e510d812badde7cfc57745b7779edb4d209b2bc5ea8d954c22305c2b",
116-
"Django-1.10.4-py2.py3-none-any.whl":
117-
"a8e1a552205cda15023c39ecf17f7e525e96c5b0142e7879e8bd0c445351f2cc",
116+
"Django-1.10.4-py2.py3-none-any.whl": "a8e1a552205cda15023c39ecf17f7e525e96c5b0142e7879e8bd0c445351f2cc", # noqa: E501
118117
"Django-1.10.3.tar.gz": "6f92f08dee8a1bd7680e098a91bf5acd08b5cdfe74137f695b60fd79f4478c30",
119-
"Django-1.10.3-py2.py3-none-any.whl":
120-
"94426cc28d8721fbf13c333053f08d32427671a4ca7986f7030fc82bdf9c88c1",
118+
"Django-1.10.3-py2.py3-none-any.whl": "94426cc28d8721fbf13c333053f08d32427671a4ca7986f7030fc82bdf9c88c1", # noqa: E501
121119
"Django-1.10.2.tar.gz": "e127f12a0bfb34843b6e8c82f91e26fff6445a7ca91d222c0794174cf97cbce1",
122-
"Django-1.10.2-py2.py3-none-any.whl":
123-
"4d48ab8e84a7c8b2bc4b2f4f199bc3a8bfcc9cbdbc29e355ac5c44a501d73a1a",
120+
"Django-1.10.2-py2.py3-none-any.whl": "4d48ab8e84a7c8b2bc4b2f4f199bc3a8bfcc9cbdbc29e355ac5c44a501d73a1a", # noqa: E501
124121
"Django-1.10.1.tar.gz": "d6e6c5b25cb67f46afd7c82f536529b11981183423dad8932e15bce93d1a24f3",
125-
"Django-1.10.1-py2.py3-none-any.whl":
126-
"3d689905cd0635bbb33b87f9a5df7ca70a3db206faae4ec58cda5e7f5f47050d",
127-
"celery-4.2.0-py2.py3-none-any.whl":
128-
"2082cbd82effa8ac8a8a58977d70bb203a9f362817e3b66f4578117b9f93d8a9",
129-
"celery-4.1.1-py2.py3-none-any.whl":
130-
"6fc4678d1692af97e137b2a9f1c04efd8e7e2fb7134c5c5ad60738cdd927762f",
122+
"Django-1.10.1-py2.py3-none-any.whl": "3d689905cd0635bbb33b87f9a5df7ca70a3db206faae4ec58cda5e7f5f47050d", # noqa: E501
123+
"celery-4.2.0-py2.py3-none-any.whl": "2082cbd82effa8ac8a8a58977d70bb203a9f362817e3b66f4578117b9f93d8a9", # noqa: E501
124+
"celery-4.1.1-py2.py3-none-any.whl": "6fc4678d1692af97e137b2a9f1c04efd8e7e2fb7134c5c5ad60738cdd927762f", # noqa: E501
131125
}
132126

133127
PYTHON_MD_PROJECT_SPECIFIER = [
@@ -145,14 +139,16 @@
145139
"celery", # matches 13
146140
"Django", # matches 31
147141
"scipy", # matches 23
142+
"setuptools", # matches 2
148143
"shelf-reader", # matches 2
149144
]
150-
PYTHON_LG_PACKAGE_COUNT = 76
145+
PYTHON_LG_PACKAGE_COUNT = 78
151146
PYTHON_LG_FIXTURE_SUMMARY = {PYTHON_CONTENT_NAME: PYTHON_LG_PACKAGE_COUNT}
147+
PYTHON_LG_FIXTURE_PRERELEASES_SUMMARY = {PYTHON_CONTENT_NAME: 92}
152148
PYTHON_LG_FIXTURE_COUNTS = {
153-
"latest_3": 35,
154-
"sdist": 23,
155-
"bdist_wheel": 53,
149+
"latest_3": 37,
150+
"sdist": 24,
151+
"bdist_wheel": 54,
156152
}
157153

158154
DJANGO_LATEST_3 = 4 # latest version has 2 dists, each other has 1
@@ -241,11 +237,15 @@
241237
# "provides_dist": [],
242238
# "obsoletes_dist": [],
243239
# "requires_external": [],
244-
"classifiers": ['Development Status :: 4 - Beta', 'Environment :: Console',
245-
'Intended Audience :: Developers',
246-
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
247-
'Natural Language :: English', 'Programming Language :: Python :: 2',
248-
'Programming Language :: Python :: 2.7'],
240+
"classifiers": [
241+
"Development Status :: 4 - Beta",
242+
"Environment :: Console",
243+
"Intended Audience :: Developers",
244+
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
245+
"Natural Language :: English",
246+
"Programming Language :: Python :: 2",
247+
"Programming Language :: Python :: 2.7",
248+
],
249249
"downloads": {"last_day": -1, "last_month": -1, "last_week": -1},
250250
# maybe add description, license is long for this one
251251
}
@@ -281,7 +281,7 @@
281281
"download_concurrency": 3,
282282
"policy": "on_demand",
283283
"prereleases": False,
284-
"excludes": ["example1", "example2"]
284+
"excludes": ["example1", "example2"],
285285
}
286286

287287
BANDERSNATCH_CONF = b"""
@@ -345,7 +345,7 @@
345345
"requires_python": None,
346346
"size": 22455,
347347
"yanked": False,
348-
"yanked_reason": None
348+
"yanked_reason": None,
349349
}
350350

351351
SHELF_SDIST_PYTHON_DOWNLOAD = {
@@ -363,17 +363,14 @@
363363
"requires_python": None,
364364
"size": 19097,
365365
"yanked": False,
366-
"yanked_reason": None
366+
"yanked_reason": None,
367367
}
368368

369369
SHELF_0DOT1_RELEASE = [SHELF_BDIST_PYTHON_DOWNLOAD, SHELF_SDIST_PYTHON_DOWNLOAD]
370370

371371
SHELF_PYTHON_JSON = {
372372
"info": PYTHON_INFO_DATA,
373373
"last_serial": 0,
374-
"releases": {
375-
"0.1": SHELF_0DOT1_RELEASE
376-
},
377-
"urls": SHELF_0DOT1_RELEASE
378-
374+
"releases": {"0.1": SHELF_0DOT1_RELEASE},
375+
"urls": SHELF_0DOT1_RELEASE,
379376
}

0 commit comments

Comments
 (0)