Skip to content

Commit

Permalink
✅ Added corresponding test
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatXliner committed Nov 25, 2023
1 parent f04de7f commit ae945a8
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,38 @@ def test_caching(capfd):
assert time.time() - start < without_cache


@pytest.mark.usefixtures("empty_cache")
def test_clean_cache(capfd):
# Initial to fill up cache
result = runner.invoke(
cli,
["tests/examples/rich_requests.py"],
)
out, _ = capfd.readouterr()
assert result.exit_code == 0
assert out == EXAMPLE_OUTPUT

start = time.time()
result = runner.invoke(
cli,
["tests/examples/rich_requests.py"],
)
out, _ = capfd.readouterr()
assert result.exit_code == 0
assert out == EXAMPLE_OUTPUT
with_cache = time.time() - start

start = time.time()
result = runner.invoke(
cli,
["tests/examples/rich_requests.py", "--clean"],
)
out, _ = capfd.readouterr()
assert result.exit_code == 0
assert out == EXAMPLE_OUTPUT
assert time.time() - start > with_cache


@pytest.mark.usefixtures("empty_cache")
def test_impossible_python():
result = runner.invoke(
Expand Down

0 comments on commit ae945a8

Please sign in to comment.