Skip to content

Commit

Permalink
Fix long test names with xdist (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
godlygeek authored Jun 6, 2023
1 parent 20dee74 commit 2fe8ee2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/pytest_memray/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def __init__(self, config: Config) -> None:
path: Path | None = config.getvalue("memray_bin_path")
self._tmp_dir: None | TemporaryDirectory[str] = None
if path is None:
# Check the MEMRAY_RESULT_PAtH environment variable. If this
# Check the MEMRAY_RESULT_PATH environment variable. If this
# is set, it means that we are running in a worker and the main
# process has set it so we'll use it as the directory to store
# the results.
Expand Down Expand Up @@ -135,7 +135,7 @@ def pytest_pyfunc_call(self, pyfuncitem: Function) -> object | None:
return

def _build_bin_path() -> Path:
if self._tmp_dir is None:
if self._tmp_dir is None and not os.getenv("MEMRAY_RESULT_PATH"):
of_id = pyfuncitem.nodeid.replace("::", "-")
of_id = of_id.replace(os.sep, "-")
name = f"{self._bin_prefix}-{of_id}.bin"
Expand Down
3 changes: 2 additions & 1 deletion tests/test_pytest_memray.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,8 @@ def allocating_func2():
allocator.valloc(1024*2)
allocator.free()
def test_foo():
@pytest.mark.parametrize("param", [("unused",)], ids=["x" * 1024])
def test_foo(param):
allocating_func1()
def test_bar():
Expand Down

0 comments on commit 2fe8ee2

Please sign in to comment.