Skip to content

Commit 27a7a5e

Browse files
committed
chore: Merge branch 'feature/test-on-pypy'
2 parents 1b9c1c6 + 1934509 commit 27a7a5e

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

.github/workflows/python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest, macos-latest, windows-latest]
15-
python-version: ['3.8', '3.9', '3.10', '3.11']
15+
python-version: ['3.8', 'pypy3.8', '3.9', 'pypy3.9', '3.10', '3.11']
1616

1717
steps:
1818
- uses: actions/checkout@v3

test/examples.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,19 @@
1717

1818

1919
def python_lib_dir() -> pathlib.Path:
20-
"""Get root folder of currently running Python libraries.
21-
22-
Currently works only for CPython and PyPy.
23-
"""
24-
lib_dir_parts = [getattr(sys, 'real_prefix', sys.prefix)]
25-
if platform.python_implementation() == 'CPython':
26-
lib_dir_parts.append('lib')
27-
if platform.system() != 'Windows':
28-
lib_dir_parts.append('python{}.{}'.format(*sys.version_info[:2]))
20+
"""Get root folder of currently running Python libraries."""
21+
lib_dir = pathlib.Path(getattr(sys, 'real_prefix', sys.prefix))
22+
assert lib_dir.is_dir(), lib_dir
23+
if platform.system() == 'Windows':
24+
lib_dir /= 'Lib'
2925
else:
30-
assert platform.python_implementation() == 'PyPy'
31-
lib_dir_parts += ['lib-python', '{}'.format(*sys.version_info[:1])]
32-
33-
lib_dir = pathlib.Path(*lib_dir_parts)
26+
# currently implemented only for CPython and PyPy
27+
implementation_dir_prefix = {
28+
'CPython': 'python',
29+
'PyPy': 'pypy'}.get(platform.python_implementation())
30+
lib_dir /= 'lib'
31+
assert lib_dir.is_dir(), lib_dir
32+
lib_dir /= f'{implementation_dir_prefix}{sys.version_info[0]}.{sys.version_info[1]}'
3433
assert lib_dir.is_dir(), lib_dir
3534
return lib_dir
3635

test/test_git.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import itertools
44
import logging
5+
import platform
6+
import unittest
57

68
import boilerplates.git_repo_tests
79

@@ -11,6 +13,9 @@
1113
_LOG = logging.getLogger(__name__)
1214

1315

16+
@unittest.skipIf(
17+
platform.system() == 'Windows' and platform.python_implementation() == 'PyPy',
18+
'skipping as these tests fail on Windows with PyPy')
1419
class Tests(boilerplates.git_repo_tests.GitRepoTests):
1520
"""Test suite for automated tests of generated git repositories.
1621

0 commit comments

Comments
 (0)