mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
Some checks are pending
Tests / Windows MSI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Ubuntu SSL tests with AWS-LC (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
This reverts commit 5292fc00f2.
62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
import sys
|
|
import unittest
|
|
|
|
from . import fixtures
|
|
from importlib.metadata import (
|
|
PackageNotFoundError,
|
|
distribution,
|
|
distributions,
|
|
entry_points,
|
|
files,
|
|
version,
|
|
)
|
|
|
|
|
|
class TestZip(fixtures.ZipFixtures, unittest.TestCase):
|
|
def setUp(self):
|
|
super().setUp()
|
|
self._fixture_on_path('example-21.12-py3-none-any.whl')
|
|
|
|
def test_zip_version(self):
|
|
self.assertEqual(version('example'), '21.12')
|
|
|
|
def test_zip_version_does_not_match(self):
|
|
with self.assertRaises(PackageNotFoundError):
|
|
version('definitely-not-installed')
|
|
|
|
def test_zip_entry_points(self):
|
|
scripts = entry_points(group='console_scripts')
|
|
entry_point = scripts['example']
|
|
self.assertEqual(entry_point.value, 'example:main')
|
|
entry_point = scripts['Example']
|
|
self.assertEqual(entry_point.value, 'example:main')
|
|
|
|
def test_missing_metadata(self):
|
|
self.assertIsNone(distribution('example').read_text('does not exist'))
|
|
|
|
def test_case_insensitive(self):
|
|
self.assertEqual(version('Example'), '21.12')
|
|
|
|
def test_files(self):
|
|
for file in files('example'):
|
|
path = str(file.dist.locate_file(file))
|
|
assert '.whl/' in path, path
|
|
|
|
def test_one_distribution(self):
|
|
dists = list(distributions(path=sys.path[:1]))
|
|
assert len(dists) == 1
|
|
|
|
|
|
class TestEgg(TestZip):
|
|
def setUp(self):
|
|
super().setUp()
|
|
self._fixture_on_path('example-21.12-py3.6.egg')
|
|
|
|
def test_files(self):
|
|
for file in files('example'):
|
|
path = str(file.dist.locate_file(file))
|
|
assert '.egg/' in path, path
|
|
|
|
def test_normalized_name(self):
|
|
dist = distribution('example')
|
|
assert dist._normalized_name == 'example'
|