Skip to content

Commit

Permalink
plugin.py::get_python_version - new pypy support
Browse files Browse the repository at this point in the history
actions/setup-python#136

Changes slightly how pypy version strings are handled to match more
recent github actions changes.
  • Loading branch information
DorianGray committed Dec 20, 2020
1 parent d987257 commit 9e018b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/tox_gh_actions/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ def get_python_version():
"""Get Python version running in string (e.g,. 3.8)
- CPython => 2.7, 3.8, ...
- PyPy => pypy2, pypy3
- PyPy => pypy-2.7, pypy-3.7
"""
if "PyPy" in sys.version:
return "pypy" + str(sys.version_info[0])
# Assuming running on CPython
return ".".join([str(i) for i in sys.version_info[:2]])
version = ".".join([str(i) for i in sys.version_info[:2]])
if "PyPy" in sys.version:
version = "pypy-" + version
return version


def is_running_on_actions():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def test_get_envlist_from_factors(envlist, factors, expected):
"3.6.9 (1608da62bfc7, Dec 23 2019, 10:50:04)\n"
"[PyPy 7.3.0 with GCC 7.3.1 20180303 (Red Hat 7.3.1-5)]",
(3, 6, 9, "final", 0),
"pypy3",
"pypy-3.6",
),
(
"2.7.13 (724f1a7d62e8, Dec 23 2019, 15:36:24)\n"
Expand Down

0 comments on commit 9e018b4

Please sign in to comment.