Skip to content

Allow max_score to be float #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def main():
parser.add_argument(
"max_score",
metavar="MAX",
type=int,
type=float,
help="max amount of points the test suite is worth",
)

Expand Down
4 changes: 2 additions & 2 deletions runner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def pytest_sessionfinish(self, session, exitstatus):
if test.is_passing():
test.score = self.results.max_score / len(self.tests)
else:
test.score = 0
test.score = 0
self.results.add(test)

def pytest_terminal_summary(self, terminalreporter):
Expand Down Expand Up @@ -198,7 +198,7 @@ def _sanitize_args(args: List[str]) -> List[str]:
return clean


def run(indir: Directory, outdir: Directory, max_score: int, args: List[str]) -> None:
def run(indir: Directory, outdir: Directory, max_score: float, args: List[str]) -> None:
"""
Run the tests for the given exercise and produce a results.json.
"""
Expand Down