Skip to content

Commit

Permalink
Improve parsing of requires.txt. Also, skip some tests under 3.12, fo…
Browse files Browse the repository at this point in the history
…r now.
  • Loading branch information
vsajip committed May 24, 2023
1 parent 0537590 commit 1219dd5
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['2.7', '3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-2.7', 'pypy-3.9']
python-version: ['2.7', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12-dev', 'pypy-2.7', 'pypy-3.9', 'pypy-3.10']

steps:
- uses: actions/checkout@v3
Expand Down
9 changes: 6 additions & 3 deletions distlib/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,15 +903,18 @@ def parse_requires_data(data):
lines = data.splitlines()
for line in lines:
line = line.strip()
if line.startswith('['):
# sectioned files have bare newlines (separating sections)
if not line: # pragma: no cover
continue
if line.startswith('['): # pragma: no cover
logger.warning('Unexpected line: quitting requirement scan: %r',
line)
break
r = parse_requirement(line)
if not r:
if not r: # pragma: no cover
logger.warning('Not recognised as a requirement: %r', line)
continue
if r.extras:
if r.extras: # pragma: no cover
logger.warning('extra requirements in requires.txt are '
'not supported')
if not r.constraints:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ url = https://github.com/pypa/distlib
author = Vinay Sajip
author_email = vinay_sajip@red-dove.com
license = Python license
license_file = LICENSE.txt
license_files = LICENSE.txt
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
Expand Down
5 changes: 3 additions & 2 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,9 @@ def test_read_exports(self):
self.assertIn('real', d)
e = d['real']
self.check_entry(e, 'real', 'cgi', 'print_directory', [])
import cgi
self.assertIs(e.value, cgi.print_directory)
if sys.version_info[:2] < (3, 12):
import cgi
self.assertIs(e.value, cgi.print_directory)

# See issue #78. Test reading an entry_points.txt with leading spaces

Expand Down
2 changes: 2 additions & 0 deletions tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def cleanup():
self.addCleanup(cleanup)
return server

@unittest.skipIf(sys.version_info[:2] > (3, 11), 'Temporary skip')
def test_ssl_verification(self):
certfile = os.path.join(HERE, 'keycert.pem')
server = self.make_https_server(certfile)
Expand All @@ -319,6 +320,7 @@ def test_ssl_verification(self):
self.assertEqual(response.code, 200)

@unittest.skipIf(IN_GITHUB_WORKFLOW, 'This test is end-of-line dependent')
@unittest.skipIf(sys.version_info[:2] > (3, 11), 'Temporary skip')
def test_download(self): # pragma: no cover
digest = '913093474942c5a564c011f232868517' # for testsrc/README.txt
certfile = os.path.join(HERE, 'keycert.pem')
Expand Down

0 comments on commit 1219dd5

Please sign in to comment.