Skip to content

Commit 0c3471c

Browse files
for some reason dev dependencies are needed to build docs
1 parent 4292ac7 commit 0c3471c

File tree

5 files changed

+84
-13
lines changed

5 files changed

+84
-13
lines changed
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: PR core dep module imports
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
paths:
11+
- "aeon/**"
12+
- ".github/workflows/**"
13+
- "pyproject.toml"
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
test-core-imports:
21+
runs-on: ubuntu-22.04
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup Python 3.10
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.10"
31+
32+
- name: Install aeon and dependencies
33+
uses: nick-fields/retry@v3
34+
with:
35+
timeout_minutes: 30
36+
max_attempts: 3
37+
command: python -m pip install .
38+
39+
- name: Show dependencies
40+
run: python -m pip list
41+
42+
- name: Run import test
43+
run: python aeon/testing/tests/test_core_imports.py

.readthedocs.yml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ python:
99
path: .
1010
extra_requirements:
1111
- docs
12-
- dev
1312

1413
build:
1514
os: ubuntu-22.04

aeon/testing/tests/__init__.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
1-
"""Tests for the aeon package and testing module utiltiies."""
1+
"""Tests for the aeon package and testing module utilties."""
2+
3+
import pkgutil
4+
5+
import aeon
6+
7+
# collect all modules
8+
ALL_AEON_MODULES = pkgutil.walk_packages(aeon.__path__, aeon.__name__ + ".")
9+
ALL_AEON_MODULES = [x[1] for x in ALL_AEON_MODULES]
10+
11+
ALL_AEON_MODULES_NO_TESTS = [
12+
x for x in ALL_AEON_MODULES if not any(part == "tests" for part in x.split("."))
13+
]
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""Tests that non-core dependencies are handled correctly in modules."""
2+
3+
import re
4+
from importlib import import_module
5+
6+
from aeon.testing.tests import ALL_AEON_MODULES_NO_TESTS
7+
8+
if __name__ == "__main__":
9+
"""Test imports in aeon modules with core dependencies only.
10+
11+
Imports all modules and catch exceptions due to missing dependencies.
12+
"""
13+
for module in ALL_AEON_MODULES_NO_TESTS:
14+
try:
15+
import_module(module)
16+
except ModuleNotFoundError as e: # pragma: no cover
17+
dependency = "unknown"
18+
match = re.search(r"\'(.+?)\'", str(e))
19+
if match:
20+
dependency = match.group(1)
21+
22+
raise ModuleNotFoundError(
23+
f"The module: {module} should not require any non-core dependencies, "
24+
f"but tried importing: '{dependency}'. Make sure non-core dependencies "
25+
f"are properly isolated outside of tests/ directories."
26+
) from e

aeon/testing/tests/test_softdeps.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
"""Tests that soft dependencies are handled correctly in modules."""
22

3-
__maintainer__ = []
4-
5-
import pkgutil
63
import re
74
from importlib import import_module
85

96
import pytest
107

11-
import aeon
128
from aeon.testing.testing_config import PR_TESTING
9+
from aeon.testing.tests import ALL_AEON_MODULES, ALL_AEON_MODULES_NO_TESTS
1310

14-
# collect all modules
15-
modules = pkgutil.walk_packages(aeon.__path__, aeon.__name__ + ".")
16-
modules = [x[1] for x in modules]
17-
18-
if PR_TESTING: # pragma: no cover
19-
# exclude test modules
20-
modules = [x for x in modules if not any(part == "tests" for part in x.split("."))]
11+
modules = ALL_AEON_MODULES_NO_TESTS if PR_TESTING else ALL_AEON_MODULES
2112

2213

2314
def test_module_crawl():

0 commit comments

Comments
 (0)