Skip to content

Commit

Permalink
test: mark slow tests as slow, print 5 slowest tests on make test
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 5, 2023
1 parent df9c6a1 commit 6d580af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ build:

test:
@# if SLOW is not set, pass `-m "not slow"` to skip slow tests
poetry run pytest ${SRCDIRS} -v \
poetry run pytest ${SRCDIRS} -v --durations=5 \
--cov=gptme --cov-report=xml --cov-report=term-missing --cov-report=html \
$(if $(SLOW),, -m "not slow") $(if $(PROFILE),--profile-svg)
$(if $(SLOW),, -m "not slow") \
$(if $(PROFILE), --profile-svg)

typecheck:
poetry run mypy --ignore-missing-imports ${SRCDIRS} --exclude ${EXCLUDES}
Expand Down
3 changes: 3 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def test_command_summarize(args: list[str], runner: CliRunner):
assert result.exit_code == 0


@pytest.mark.slow
def test_command_save(args: list[str], runner: CliRunner):
# tests the /save command
args.append(f"{CMDFIX}impersonate ```python\nprint('hello')\n```")
Expand All @@ -93,6 +94,7 @@ def test_command_fork(args: list[str], runner: CliRunner, name: str):
assert result.exit_code == 0


@pytest.mark.slow
def test_fileblock(args: list[str], runner: CliRunner):
# tests saving with a ```filename.txt block
args.append(f"{CMDFIX}impersonate ```hello.py\nprint('hello')\n```")
Expand Down Expand Up @@ -141,6 +143,7 @@ def test_python_error(args: list[str], runner: CliRunner):
blocks = {"python": _block_py, "sh": _block_sh}


@pytest.mark.slow
@pytest.mark.parametrize("lang", ["python", "sh"])
def test_block(args: list[str], lang: str, runner: CliRunner):
# tests that shell codeblocks are formatted correctly such that whitespace and newlines are preserved
Expand Down

0 comments on commit 6d580af

Please sign in to comment.