Skip to content

Commit

Permalink
tests: fixes to work without json api
Browse files Browse the repository at this point in the history
  • Loading branch information
abn authored and neersighted committed Mar 23, 2024
1 parent 9e00df9 commit 1198d94
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 9 deletions.
8 changes: 6 additions & 2 deletions tests/installation/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,11 @@ def test_installer_required_extras_should_not_be_removed_when_updating_single_de
executor=Executor(env, pool, config, NullIO()),
)

package.add_dependency(Factory.create_dependency("poetry", {"version": "^0.12.0"}))
package.add_dependency(
Factory.create_dependency(
"with-transitive-extra-dependency", {"version": "^0.12"}
)
)

installer.update(True)
result = installer.run()
Expand Down Expand Up @@ -1979,7 +1983,7 @@ def test_installer_required_extras_should_be_installed(
)
package.add_dependency(
Factory.create_dependency(
"cachecontrol", {"version": "^0.12.5", "extras": ["filecache"]}
"with-extra-dependency", {"version": "^0.12", "extras": ["filecache"]}
)
)

Expand Down
7 changes: 4 additions & 3 deletions tests/puzzle/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3019,18 +3019,19 @@ def test_solver_can_solve_with_legacy_repository_using_proper_python_compatible_
def test_solver_skips_invalid_versions(
package: ProjectPackage, io: NullIO, pypi_repository: PyPiRepository
) -> None:
package.python_versions = "^3.7"
package.python_versions = "^3.9"

pool = RepositoryPool([pypi_repository])

solver = Solver(package, pool, [], [], io)

package.add_dependency(Factory.create_dependency("trackpy", "^0.4"))
package.add_dependency(Factory.create_dependency("six-unknown-version", "^1.11"))

transaction = solver.solve()

check_solver_result(
transaction, [{"job": "install", "package": get_package("trackpy", "0.4.1")}]
transaction,
[{"job": "install", "package": get_package("six-unknown-version", "1.11.0")}],
)


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"info": {
"author": "Benjamin Peterson",
"author_email": "benjamin@python.org",
"bugtrack_url": null,
"classifiers": [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities"
],
"description": "",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"dynamic": null,
"home_page": "http://pypi.python.org/pypi/six/",
"keywords": "",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "six-unknown-version",
"package_url": "https://pypi.org/project/six/",
"platform": "",
"project_url": "https://pypi.org/project/six/",
"project_urls": {
"Homepage": "http://pypi.python.org/pypi/six/"
},
"provides_extra": null,
"release_url": "https://pypi.org/project/six/1.11.0/",
"requires_dist": null,
"requires_python": "",
"summary": "Python 2 and 3 compatibility utilities",
"version": "1.11.0",
"yanked": false,
"yanked_reason": null
},
"last_serial": 0,
"urls": [
{
"comment_text": "",
"digests": {
"md5": "b126a063c665f4c66f23bfd8dc6ebff5",
"sha256": "1d9f63b87ee9f0aee49e9d9f8d7883319836bc43f17321b488bc38933827d2c0"
},
"downloads": -1,
"filename": "six_unknown_version-1.11.0.tar.gz",
"has_sig": false,
"md5_digest": "25d3568604f921dd23532b88a0ce17e7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 29860,
"upload_time": "2017-09-17T18:46:54",
"upload_time_iso_8601": "2017-09-17T18:46:54.492027Z",
"url": "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six_unknown_version-1.11.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"vulnerabilities": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"info": {
"author": "Benjamin Peterson",
"author_email": "benjamin@python.org",
"bugtrack_url": null,
"classifiers": [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities"
],
"description": "",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"dynamic": null,
"home_page": "http://pypi.python.org/pypi/six/",
"keywords": "",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "with-extra-dependency",
"package_url": "https://pypi.org/project/six/",
"platform": "",
"project_url": "https://pypi.org/project/six/",
"project_urls": {
"Homepage": "http://pypi.python.org/pypi/six/"
},
"provides_extra": null,
"release_url": "https://pypi.org/project/six/0.12.4/",
"requires_dist": [
"filecache; extra == 'filecache'"
],
"requires_python": "",
"summary": "Python 2 and 3 compatibility utilities",
"version": "0.12.4",
"yanked": false,
"yanked_reason": null
},
"last_serial": 0,
"urls": [
{
"comment_text": "",
"digests": {
"md5": "b126a063c665f4c66f23bfd8dc6ebff5",
"sha256": "1d9f63b87ee9f0aee49e9d9f8d7883319836bc43f17321b488bc38933827d2c0"
},
"downloads": -1,
"filename": "with_extra_dependency-0.12.4.tar.gz",
"has_sig": false,
"md5_digest": "25d3568604f921dd23532b88a0ce17e7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 29860,
"upload_time": "2017-09-17T18:46:54",
"upload_time_iso_8601": "2017-09-17T18:46:54.492027Z",
"url": "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/with_extra_dependency-0.12.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"vulnerabilities": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"info": {
"author": "Benjamin Peterson",
"author_email": "benjamin@python.org",
"bugtrack_url": null,
"classifiers": [
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities"
],
"description": "",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"dynamic": null,
"home_page": "http://pypi.python.org/pypi/six/",
"keywords": "",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "with-transitive-extra-dependency",
"package_url": "https://pypi.org/project/six/",
"platform": "",
"project_url": "https://pypi.org/project/six/",
"project_urls": {
"Homepage": "http://pypi.python.org/pypi/six/"
},
"provides_extra": null,
"release_url": "https://pypi.org/project/six/0.12.4/",
"requires_dist": [
"with-extra-dependency[filecache] (>=0.12.4,<0.13.0)"
],
"requires_python": "",
"summary": "Python 2 and 3 compatibility utilities",
"version": "0.12.4",
"yanked": false,
"yanked_reason": null
},
"last_serial": 0,
"urls": [
{
"comment_text": "",
"digests": {
"md5": "b126a063c665f4c66f23bfd8dc6ebff5",
"sha256": "1d9f63b87ee9f0aee49e9d9f8d7883319836bc43f17321b488bc38933827d2c0"
},
"downloads": -1,
"filename": "with_transitive_extra_dependency-0.12.4.tar.gz",
"has_sig": false,
"md5_digest": "25d3568604f921dd23532b88a0ce17e7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 29860,
"upload_time": "2017-09-17T18:46:54",
"upload_time_iso_8601": "2017-09-17T18:46:54.492027Z",
"url": "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/with_transitive_extra_dependency-0.12.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"vulnerabilities": []
}
9 changes: 5 additions & 4 deletions tests/repositories/test_pypi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_find_packages_with_prereleases(pypi_repository: PyPiRepository) -> None
repo = pypi_repository
packages = repo.find_packages(Factory.create_dependency("toga", ">=0.3.0.dev2"))

assert len(packages) == 7
assert len(packages) == 2


def test_find_packages_does_not_select_prereleases_if_not_allowed(
Expand Down Expand Up @@ -104,8 +104,7 @@ def test_package(
f"{package.name}-{package.version}.tar.gz",
]
]

win_inet = package.extras[canonicalize_name("socks")][0]
win_inet = package.extras[canonicalize_name("socks")][1]
assert win_inet.name == "win-inet-pton"
assert win_inet.python_versions == "~2.7 || ~2.6"

Expand Down Expand Up @@ -314,7 +313,9 @@ def test_invalid_versions_ignored(pypi_repository: PyPiRepository) -> None:

# the json metadata for this package contains one malformed version
# and a correct one.
packages = repo.find_packages(Factory.create_dependency("pygame-music-grid", "*"))
packages = repo.find_packages(
Factory.create_dependency("invalid-version-package", "*")
)
assert len(packages) == 1


Expand Down

0 comments on commit 1198d94

Please sign in to comment.