Skip to content

Commit 60451e4

Browse files
committed
refact: move to src layout
Because the design of the tests requires them to import `tests.common.py`, the tests folder must be a package, necessitating an `__init__.py` module at its root. As a result of this configuration, pytest, by default, makes the source package importable, which masks the package installed in the virtual environment. This behavior prevents testing wheels. The [documentation of pytest](https://docs.pytest.org/en/6.2.x/goodpractices.html#src-layout) therefore recommends to use the `src-layout`.
1 parent 4dec7f5 commit 60451e4

File tree

105 files changed

+14
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+14
-14
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ format: install format/black ## run black formatting (depends install)
110110
.PHONY: format/black
111111
format/black: install ## run black formatting (depends install) (source venv before)
112112
@echo "+ $@"
113-
@${PANDORA_VENV}/bin/black pandora tests ./*.py notebooks/snippets/*.py
113+
@${PANDORA_VENV}/bin/black src/pandora tests ./*.py notebooks/snippets/*.py
114114

115115
### Check code quality and linting : black, mypy, pylint
116116

@@ -120,17 +120,17 @@ lint: install lint/black lint/mypy lint/pylint ## check code quality and linting
120120
.PHONY: lint/black
121121
lint/black: ## check global style with black
122122
@echo "+ $@"
123-
@${PANDORA_VENV}/bin/black --check pandora tests ./*.py notebooks/snippets/*.py
123+
@${PANDORA_VENV}/bin/black --check src/pandora tests ./*.py notebooks/snippets/*.py
124124

125125
.PHONY: lint/mypy
126126
lint/mypy: ## check linting with mypy
127127
@echo "+ $@"
128-
@${PANDORA_VENV}/bin/mypy pandora tests
128+
@${PANDORA_VENV}/bin/mypy src/pandora tests
129129

130130
.PHONY: lint/pylint
131131
lint/pylint: ## check linting with pylint
132132
@echo "+ $@"
133-
@set -o pipefail; ${PANDORA_VENV}/bin/pylint pandora tests --rcfile=.pylintrc --output-format=parseable --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" # | tee pylint-report.txt # pipefail to propagate pylint exit code in bash
133+
@set -o pipefail; ${PANDORA_VENV}/bin/pylint src/pandora tests --rcfile=.pylintrc --output-format=parseable --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" # | tee pylint-report.txt # pipefail to propagate pylint exit code in bash
134134

135135
## Documentation section
136136

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
import os
3535
import sys
3636

37-
sys.path.insert(0, os.path.abspath("../pandora"))
37+
sys.path.insert(0, os.path.abspath("../src/pandora"))
3838

3939
# Extend Recursion limit for RecursionError in big files (bug astroid)
4040
sys.setrecursionlimit(8 * sys.getrecursionlimit())
@@ -70,7 +70,7 @@
7070
imgmath_embed = True
7171

7272
# Autoapi configuration
73-
autoapi_dirs = ["../../pandora"]
73+
autoapi_dirs = ["../../src/pandora"]
7474
autoapi_root = "api_reference"
7575
autoapi_keep_files = True
7676
autoapi_options = [

meson.build

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ doctest_dep = dependency('doctest', required: get_option('build_cpp_tests'))
1919
python_dep = py.dependency(embed: true, required: get_option('build_cpp_tests'))
2020

2121
install_subdir(
22-
'pandora',
22+
'src/pandora',
2323
install_dir: py.get_install_dir() / 'pandora',
2424
strip_directory: true,
2525
)
2626

27-
subdir('pandora/cpp')
27+
subdir('src/pandora/cpp')
2828

29-
subdir('pandora/validation/cpp')
29+
subdir('src/pandora/validation/cpp')
3030

31-
subdir('pandora/aggregation/cpp')
31+
subdir('src/pandora/aggregation/cpp')
3232

33-
subdir('pandora/cost_volume_confidence/cpp')
33+
subdir('src/pandora/cost_volume_confidence/cpp')
3434

35-
subdir('pandora/refinement/cpp')
35+
subdir('src/pandora/refinement/cpp')
3636

37-
subdir('pandora/matching_cost/cpp')
37+
subdir('src/pandora/matching_cost/cpp')
3838

3939
if get_option('build_cpp_tests').enabled()
4040
subdir('tests/test_cpp/')

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sonar.projectName=Pandora
66
sonar.projectVersion=0.1
77

88
# path to source directories (required)
9-
sonar.sources=pandora
9+
sonar.sources=src/pandora
1010

1111
# path to test source directories (optional)
1212
sonar.tests=tests
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)