Running pytest's under uv directly fails with a big bang
- Dominant language
- Python
- Stars
- 5
- Forks
- 6
- Avg merge
- 4h 6m
- Merged PRs (30d)
- 1
Description
```
❯ uv venv && source .venv/bin/activate && uv pip install -e . --group dev-all && python -m pytest -s -v -x
Using CPython 3.11.12
Creating virtual environment at: .venv
Activate with: source .venv/bin/activate
Resolved 127 packages in 340ms
Built nwb2bids @ file:///home/yoh/proj/dandi/nwb2bids
Prepared 1 package in 119ms
Installed 127 packages in 222ms
+ accessible-pygments==0.0.5
+ alabaster==1.0.0
+ annexremote==1.6.6
+ annotated-types==0.7.0
+ asttokens==3.0.1
+ attrs==25.4.0
+ babel==2.17.0
+ backports-tarfile==1.2.0
+ beautifulsoup4==4.14.3
+ boto3==1.42.23
+ botocore==1.42.23
+ certifi==2026.1.4
+ cffi==2.0.0
+ cfgv==3.5.0
+ chardet==5.2.0
+ charset-normalizer==3.4.4
+ click==8.3.1
+ coverage==7.13.1
+ cryptography==46.0.3
+ datalad==1.2.3
+ decorator==5.2.1
+ distlib==0.4.0
+ distro==1.9.0
+ docutils==0.21.2
+ executing==2.2.1
+ fasteners==0.20
+ filelock==3.20.2
+ git-annex==10.20251215
+ h5py==3.15.1
+ hdmf==4.2.0
+ humanize==4.15.0
+ identify==2.6.15
+ idna==3.11
+ imagesize==1.4.1
+ importlib-metadata==8.7.1
+ iniconfig==2.3.0
+ ipython==9.9.0
+ ipython-pygments-lexers==1.1.1
+ iso8601==2.1.0
+ jaraco-classes==3.4.0
+ jaraco-context==6.0.2
+ jaraco-functools==4.4.0
+ jedi==0.19.2
+ jeepney==0.9.0
+ jinja2==3.1.6
+ jmespath==1.0.1
+ jsonschema==4.26.0
+ jsonschema-specifications==2025.9.1
+ keyring==25.7.0
+ keyrings-alt==5.0.2
+ librt==0.7.7
+ looseversion==1.3.0
+ markdown-it-py==3.0.0
+ markupsafe==3.0.3
+ matplotlib-inline==0.2.1
+ mdit-py-plugins==0.5.0
+ mdurl==0.1.2
+ more-itertools==10.8.0
+ msgpack==1.1.2
+ mypy==1.19.1
+ mypy-extensions==1.1.0
+ myst-parser==4.0.1
+ nodeenv==1.10.0
+ numpy==2.3.5
+ nwb2bids==0.9.1.dev3+g2e89eff1c (from file:///home/yoh/proj/dandi/nwb2bids)
+ packaging==25.0
+ pandas==2.3.3
+ pandas-stubs==2.3.3.251219
+ parso==0.8.5
+ pathspec==1.0.1
+ patool==4.0.3
+ pexpect==4.9.0
+ platformdirs==4.5.1
+ pluggy==1.6.0
+ pre-commit==4.5.1
+ prompt-toolkit==3.0.52
+ ptyprocess==0.7.0
+ pure-eval==0.2.3
+ pycparser==2.23
+ pydantic==2.12.5
+ pydantic-core==2.41.5
+ pydata-sphinx-theme==0.16.1
+ pygments==2.19.2
+ pynwb==3.1.3
+ pytest==9.0.2
+ pytest-cov==7.0.0
+ python-dateutil==2.9.0.post0
+ python-gitlab==7.1.0
+ pytz==2025.2
+ pyyaml==6.0.3
+ referencing==0.37.0
+ requests==2.32.5
+ requests-toolbelt==1.0.0
+ rich==14.2.0
+ rich-click==1.9.5
+ roman-numerals==4.1.0
+ roman-numerals-py==4.1.0
+ rpds-py==0.30.0
+ ruamel-yaml==0.18.17
+ ruamel-yaml-clib==0.2.15
+ s3transfer==0.16.0
+ secretstorage==3.5.0
+ six==1.17.0
+ snowballstemmer==3.0.1
+ soupsieve==2.8.1
+ sphinx==8.2.3
+ sphinx-copybutton==0.5.2
+ sphinx-tabs==3.4.7
+ sphinx-toggleprompt==0.6.0
+ sphinxcontrib-applehelp==2.0.0
+ sphinxcontrib-devhelp==2.0.0
+ sphinxcontrib-htmlhelp==2.1.0
+ sphinxcontrib-jsmath==1.0.1
+ sphinxcontrib-qthelp==2.0.0
+ sphinxcontrib-serializinghtml==2.0.0
+ stack-data==0.6.3
+ sybil==9.3.0
+ tqdm==4.67.1
+ traitlets==5.14.3
+ types-pytz==2025.2.0.20251108
+ typing-extensions==4.15.0
+ typing-inspection==0.4.2
+ tzdata==2025.3
+ urllib3==2.6.3
+ virtualenv==20.36.0
+ wcwidth==0.2.14
+ zipp==3.23.0
====================================================================================================== test session starts =======================================================================================================
platform linux -- Python 3.11.12, pytest-9.0.2, pluggy-1.6.0 -- /home/yoh/proj/dandi/nwb2bids/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/yoh/proj/dandi/nwb2bids
configfile: pyproject.toml
testpaths: tests
plugins: cov-7.0.0
collected 75 items
tests/cli/test_cli.py::test_minimal_cli_on_directory FAILED
============================================================================================================ FAILURES ============================================================================================================
_________________________________________________________________________________________________ test_minimal_cli_on_directory __________________________________________________________________________________________________
minimal_nwbfile_path = PosixPath('/home/yoh/.tmp/pytest-of-yoh/pytest-0/nwb2bids_testing_files/minimal/minimal.nwb')
temporary_bids_directory = PosixPath('/home/yoh/.tmp/pytest-of-yoh/pytest-0/test_minimal_cli_on_directory0/bids')
def test_minimal_cli_on_directory(minimal_nwbfile_path: pathlib.Path, temporary_bids_directory: pathlib.Path):
command = f"nwb2bids convert {minimal_nwbfile_path.parent} -o {temporary_bids_directory}"
result = subprocess.run(args=command, shell=True, capture_output=True)
assert (
result.returncode == 0
), f"\n\nCLI command failed with:\nStandard Output: {result.stdout}\nStandard Error: {result.stderr}\n\n"
expected_structure = {
temporary_bids_directory: {
"directories": {"sub-123"},
"files": {"dataset_description.json", "participants.json", "participants.tsv"},
},
temporary_bids_directory
/ "sub-123": {
"directories": {"ses-456"},
"files": {"sub-123_sessions.json", "sub-123_sessions.tsv"},
},
temporary_bids_directory
/ "sub-123"
/ "ses-456": {
"directories": {"ecephys"},
"files": set(),
},
temporary_bids_directory
/ "sub-123"
/ "ses-456"
/ "ecephys": {
"directories": set(),
"files": {
"sub-123_ses-456_ecephys.nwb",
},
},
}
> nwb2bids.testing.assert_subdirectory_structure(
directory=temporary_bids_directory, expected_structure=expected_structure
)
tests/cli/test_cli.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py:39: in wrapper_function
return wrapper(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.11/site-packages/pydantic/_internal/_validate_call.py:136: in __call__
res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
@pydantic.validate_call
def assert_subdirectory_structure(
*,
directory: pathlib.Path,
expected_structure: dict[pathlib.Path, dict[typing.Literal["directories", "files"], set[str]]],
include_hidden: bool = False,
) -> None:
"""
Assert that the subdirectory structure matches the expected structure.
Parameters
----------
directory : directory path
The path to the directory whose structure is to be checked.
expected_structure : dict
A dictionary representing the expected structure of the subdirectory.
Keys are the full paths per expected subdirectory.
Values are dictionaries with required 'directories' and 'files' keys whose values are sets of string names for
all expected entities at that level.
"""
# Future TODO: adjust to pathlib.Path.walk once 3.12 is minimum
for current_dir, directories, files in os.walk(top=directory):
directories[:] = [d for d in directories if not d.startswith(".")]
files = [f for f in files if not f.startswith(".")]
current_dir_path = pathlib.Path(current_dir)
expected = expected_structure.get(current_dir_path, None)
assert expected is not None, (
f"\n\nUnexpected subdirectory {current_dir_path}.\n\n"
f"Expected subdirectories: {list(expected_structure.keys())}\n"
)
assert set(expected.keys()) == {"directories", "files"}, (
f"\n\nUnexpected keys in expected structure for {current_dir_path}.\n\n"
f"Expected keys: 'directories', 'files'\n"
f"Found keys: {set(expected.keys())}\n\n"
)
> assert set(directories) == set(expected["directories"]), (
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
f"\n\nUnexpected directories in {current_dir_path}.\n\n"
f"Expected: {expected['directories']}\n"
f"Found: {set(directories)}\n"
f"Unexpected: {set(directories) - set(expected['directories'])}\n"
f"Missing: {set(expected['directories']) - set(directories)}\n\n"
)
E AssertionError:
E
E Unexpected directories in /home/yoh/.tmp/pytest-of-yoh/pytest-0/test_minimal_cli_on_directory0/bids.
E
E Expected: {'sub-123'}
E Found: set()
E Unexpected: set()
E Missing: {'sub-123'}
src/nwb2bids/testing/_assert_subdirectory_structure.py:45: AssertionError
==================================================================================================== short test summary info =====================================================================================================
FAILED tests/cli/test_cli.py::test_minimal_cli_on_directory - AssertionError:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================================================= 1 failed in 0.67s ========================================================================================================
python -m pytest -s -v -x 5,51s user 0,20s system 245% cpu 2,324 total
```
does this work for you?
Contributor guide
Assessment
This issue has not been assessed yet.