Skip to content

Commit

Permalink
Structure tests/ dir as package
Browse files Browse the repository at this point in the history
  • Loading branch information
jlumpe committed Jul 10, 2024
1 parent 0a53a8f commit 7267f0a
Show file tree
Hide file tree
Showing 27 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
Adding the __init__.py to the tests/ directory (and its subdirectories) makes them all part of the
same package structure.
- Allows test modules/files to import from each other (including from modules in different
directories, such as files in tests/cli/ importing from tests/testdb.py).
- Does not require test modules to have unique names.
This necessitates using the "prepend" (or possibly "append"?) import mode (which is the default).
This setup comes with its own set of caveats. See
https://docs.pytest.org/en/7.1.x/explanation/pythonpath.html for a discussion of how test modules
are imported.
"""
Empty file added tests/benchmarks/__init__.py
Empty file.
Empty file added tests/cli/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import numpy as np
import pytest
from sqlalchemy import create_engine
from testdb import TestDB

from .testdb import TestDB


@pytest.fixture(scope='session')
Expand Down
Empty file added tests/data/__init__.py
Empty file.
Empty file added tests/db/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added tests/sigs/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added tests/util/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7267f0a

Please sign in to comment.