Skip to content

Commit 0247451

Browse files
committed
Minor changes needed to support Python 3.10
1 parent 4d0c9a9 commit 0247451

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

jmu_pytest_utils/coverage.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,16 @@ def assert_cover(main_filename: str, test_filename: str, branches: bool = False,
160160
line_penalty: Points per missed line.
161161
branch_penalty: Points per missed branch.
162162
"""
163-
run_command([
163+
args = [
164164
"pytest",
165165
"--cov=" + main_filename[:-3], # remove .py suffix
166-
"--cov-branch" if branches else "",
167166
"--cov-report=json",
168167
test_filename
169-
])
168+
]
169+
if branches:
170+
# Using insert to avoid sending an empty string to subprocess.run()
171+
args.insert(2, "--cov-branch")
172+
run_command(args)
170173
if not os.path.exists("coverage.json"):
171174
pytest.fail("pytest failed to generate coverage results", False)
172175
with open("coverage.json") as file:

jmu_pytest_utils/quiz.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _type_name(value: Any) -> str:
5252

5353

5454
def check_return_types(
55-
*calls: tuple[type, Callable[..., Any], *tuple[Any, ...]],
55+
*calls: tuple[type, Callable[..., Any], tuple[Any, ...]],
5656
) -> None:
5757
"""Verify the return type of one or more function calls.
5858
@@ -67,7 +67,7 @@ def check_return_types(
6767
calls: Tuples of (expected_type, function, *args).
6868
"""
6969
output = ""
70-
for expected_type, function, *args in calls:
70+
for expected_type, function, args in calls:
7171
try:
7272
result = function(*args)
7373
if isinstance(result, expected_type):

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
description="pytest plugin for Gradescope autograders",
99
author="Chris Mayfield",
1010
author_email="[email protected]",
11+
url="https://github.com/JMU-CS/jmu_pytest_utils",
1112
packages=find_packages(),
1213
classifiers=[
1314
"Framework :: Pytest",
@@ -31,4 +32,5 @@
3132
"jmu_pytest_utils = jmu_pytest_utils.plugin",
3233
],
3334
},
35+
python_requires=">=3.10",
3436
)

0 commit comments

Comments
 (0)