Skip to content

[Bug]: validation tests fail due to subprocesses running from missing dir #1534

@oruebel

Description

@oruebel

What happened?

When running python test.py from the main directory, I get errors from the validation test suite because it seems to try and run subprocesses from a subdirectory coverage that doesn't exist (see trace below)

Steps to Reproduce

Run ``python test.py`` from the root dir.

Traceback

=====================================================
2022-08-10 12:47:57,569 - INFO - running validation CLI tests
EEEEEE
======================================================================
ERROR: test_validate_file_cached (validation.test_validate.TestValidateScript)
Test that validating a file with cached spec against its cached namespace succeeds.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/oruebel/Devel/nwb/pynwb/tests/validation/test_validate.py", line 59, in test_validate_file_cached
    result = subprocess.run(["coverage", "run", "-p", "-m", "pynwb.validate",
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'coverage'

======================================================================
ERROR: test_validate_file_cached_bad_ns (validation.test_validate.TestValidateScript)
Test that validating a file with cached spec against a specified, unknown namespace fails.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/oruebel/Devel/nwb/pynwb/tests/validation/test_validate.py", line 71, in test_validate_file_cached_bad_ns
    result = subprocess.run(["coverage", "run", "-p", "-m", "pynwb.validate",
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'coverage'

======================================================================
ERROR: test_validate_file_cached_hdmf_common (validation.test_validate.TestValidateScript)
Test that validating a file with cached spec against the hdmf-common namespace fails.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/oruebel/Devel/nwb/pynwb/tests/validation/test_validate.py", line 84, in test_validate_file_cached_hdmf_common
    result = subprocess.run(["coverage", "run", "-p", "-m", "pynwb.validate", "tests/back_compat/1.1.2_nwbfile.nwb",
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'coverage'

======================================================================
ERROR: test_validate_file_cached_ignore (validation.test_validate.TestValidateScript)
Test that validating a file with cached spec against the core namespace succeeds.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/oruebel/Devel/nwb/pynwb/tests/validation/test_validate.py", line 95, in test_validate_file_cached_ignore
    result = subprocess.run(["coverage", "run", "-p", "-m", "pynwb.validate", "tests/back_compat/1.1.2_nwbfile.nwb",
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'coverage'

======================================================================
ERROR: test_validate_file_no_cache (validation.test_validate.TestValidateScript)
Test that validating a file with no cached spec against the core namespace succeeds.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/oruebel/Devel/nwb/pynwb/tests/validation/test_validate.py", line 24, in test_validate_file_no_cache
    result = subprocess.run(["coverage", "run", "-p", "-m", "pynwb.validate",
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'coverage'

======================================================================
ERROR: test_validate_file_no_cache_bad_ns (validation.test_validate.TestValidateScript)
Test that validating a file with no cached spec against a specified, unknown namespace fails.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/oruebel/Devel/nwb/pynwb/tests/validation/test_validate.py", line 42, in test_validate_file_no_cache_bad_ns
    result = subprocess.run(["coverage", "run", "-p", "-m", "pynwb.validate", "tests/back_compat/1.0.2_nwbfile.nwb",
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/oruebel/miniforge3/envs/py4nwb/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'coverage'

----------------------------------------------------------------------
Ran 11 tests in 0.175s


### Operating System

macOS

### Python Executable

Python

### Python Version

3.9

### Package Versions

_No response_

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/.github/CODE_OF_CONDUCT.rst)
- [X] Have you checked the [Contributing](https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/docs/CONTRIBUTING.rst) document?
- [X] Have you ensured this bug was not already [reported](https://github.com/NeurodataWithoutBorders/pynwb/issues)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions