Skip to content

Commit 2fe8ee2

Browse files
authored
Fix long test names with xdist (#77)
1 parent 20dee74 commit 2fe8ee2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/pytest_memray/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def __init__(self, config: Config) -> None:
9191
path: Path | None = config.getvalue("memray_bin_path")
9292
self._tmp_dir: None | TemporaryDirectory[str] = None
9393
if path is None:
94-
# Check the MEMRAY_RESULT_PAtH environment variable. If this
94+
# Check the MEMRAY_RESULT_PATH environment variable. If this
9595
# is set, it means that we are running in a worker and the main
9696
# process has set it so we'll use it as the directory to store
9797
# the results.
@@ -135,7 +135,7 @@ def pytest_pyfunc_call(self, pyfuncitem: Function) -> object | None:
135135
return
136136

137137
def _build_bin_path() -> Path:
138-
if self._tmp_dir is None:
138+
if self._tmp_dir is None and not os.getenv("MEMRAY_RESULT_PATH"):
139139
of_id = pyfuncitem.nodeid.replace("::", "-")
140140
of_id = of_id.replace(os.sep, "-")
141141
name = f"{self._bin_prefix}-{of_id}.bin"

tests/test_pytest_memray.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ def allocating_func2():
470470
allocator.valloc(1024*2)
471471
allocator.free()
472472
473-
def test_foo():
473+
@pytest.mark.parametrize("param", [("unused",)], ids=["x" * 1024])
474+
def test_foo(param):
474475
allocating_func1()
475476
476477
def test_bar():

0 commit comments

Comments
 (0)