Skip to content

Commit

Permalink
test: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Oct 31, 2024
1 parent c6d04c8 commit f797c21
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
25 changes: 16 additions & 9 deletions src/ape/pytest/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,22 @@ def pytest_exception_interact(self, report, call):
# Else, it gets way too noisy.
show_locals = not self.config_wrapper.show_internal

report.longrepr = call.excinfo.getrepr(
funcargs=True,
abspath=Path.cwd(),
showlocals=show_locals,
style="short",
tbfilter=False,
truncate_locals=True,
chain=False,
)
try:
here = Path.cwd()

except FileNotFoundError:
pass # In a temp-folder, most likely.

else:
report.longrepr = call.excinfo.getrepr(
funcargs=True,
abspath=here,
showlocals=show_locals,
style="short",
tbfilter=False,
truncate_locals=True,
chain=False,
)

if self.config_wrapper.interactive and report.failed:
traceback = call.excinfo.traceback[-1]
Expand Down
3 changes: 2 additions & 1 deletion tests/functional/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,10 @@ def test_init_invalid_config(self):

os.chdir(temp_dir)
expected = r"[.\n]*Input should be a valid string\n-->1: name:\n 2: {asdf}[.\n]*"
weird_project = Project(temp_dir)
try:
with pytest.raises(ConfigError, match=expected):
_ = Project(temp_dir)
_ = weird_project.path
finally:
os.chdir(here)

Expand Down

0 comments on commit f797c21

Please sign in to comment.