Skip to content

Commit 234f458

Browse files
authored
Merge pull request #83 from ColtonPayne/main
Final Testing Changes
2 parents 52013ee + c95621d commit 234f458

29 files changed

+496
-1334
lines changed

.github/workflows/python-package-version-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ jobs:
3535
python -m ruff check pyreason/scripts
3636
- name: Pytest Unit Tests with JIT Disabled
3737
run: |
38-
pytest tests/unit/disable_jit -m "not slow" --tb=short -q
38+
pytest tests/unit/disable_jit --tb=short -q
3939
- name: Pytest Unit Tests with JIT Enabled
4040
run: |
41-
pytest tests/unit/dont_disable_jit -m "not slow" --tb=short -q
41+
pytest tests/unit/dont_disable_jit --tb=short -q
4242
- name: Pytest API Tests
4343
run: |
44-
pytest tests/unit/api_tests --tb=short -q
44+
pytest tests/api_tests --tb=short -q
4545
- name: Pytest Functional Tests
4646
run: |
47-
pytest tests/functional/ --tb=short
47+
pytest tests/functional/ --tb=short -q

.pre-commit-config.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ repos:
1818
pass_filenames: false
1919
stages: [pre-commit]
2020

21+
- id: sync-interpretation-parallel
22+
name: Sync interpretation_parallel.py from interpretation.py
23+
entry: .venv/bin/python sync_interpretation_parallel.py
24+
language: system
25+
pass_filenames: false
26+
files: 'pyreason/scripts/interpretation/interpretation\.py'
27+
stages: [pre-commit]
28+
2129
- id: pytest-unit-no-jit
2230
name: Run JIT-disabled unit tests
2331
entry: .venv/bin/python -m pytest tests/unit/disable_jit -m "not slow" --tb=short -q
@@ -34,15 +42,15 @@ repos:
3442

3543
# --- PUSH STAGE: Complete test suite ---
3644
- id: pytest-unit-api
37-
name: Run pyreason api unit tests
38-
entry: .venv/bin/python -m pytest tests/unit/api_tests --tb=short -q
45+
name: Run pyreason api tests
46+
entry: .venv/bin/python -m pytest tests/api_tests --tb=short -q
3947
language: system
4048
pass_filenames: false
4149
stages: [pre-push]
4250

4351
- id: pytest-functional-complete
4452
name: Run functional test suite
45-
entry: .venv/bin/python -m pytest tests/functional/ --tb=short
53+
entry: .venv/bin/python -m pytest tests/functional/ --tb=short -q
4654
language: system
4755
pass_filenames: false
4856
stages: [pre-push]

Makefile

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Provides convenient shortcuts for running different test configurations
33

44
.PHONY: help test test-all test-fast test-api test-jit test-no-jit test-consistency \
5-
test-parallel test-no-coverage coverage-report coverage-html coverage-xml \
5+
test-parallel test-sequential test-no-coverage coverage-report coverage-html coverage-xml \
66
clean clean-coverage clean-reports install-deps lint check-deps
77

88
# Default target
@@ -37,16 +37,16 @@ help: ## Show this help message
3737
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " $(GREEN)%-20s$(RESET) %s\n", $$1, $$2}' $(MAKEFILE_LIST)
3838
@echo ""
3939
@echo "$(BLUE)Examples:$(RESET)"
40-
@echo " make test # Run all test suites with coverage and open report"
40+
@echo " make test # Run all test suites in parallel with coverage"
41+
@echo " make test-sequential # Run all test suites sequentially (slower)"
4142
@echo " make test-fast # Run only fast test suites"
4243
@echo " make test-api # Run only API tests"
43-
@echo " make test-parallel # Run tests in parallel where possible"
4444
@echo " make coverage-html # Generate HTML coverage report"
4545

4646
# Main test targets
47-
test: ## Run all test suites with coverage and open report
48-
@echo "$(BOLD)$(BLUE)Running all test suites...$(RESET)"
49-
$(RUN_TESTS)
47+
test: ## Run all test suites with coverage and open report (in parallel)
48+
@echo "$(BOLD)$(BLUE)Running all test suites in parallel...$(RESET)"
49+
$(RUN_TESTS) --parallel
5050
@echo "$(BOLD)$(GREEN)Opening coverage report in browser...$(RESET)"
5151
@if [ -f test_reports/htmlcov/index.html ]; then \
5252
open test_reports/htmlcov/index.html 2>/dev/null || \
@@ -58,8 +58,12 @@ test: ## Run all test suites with coverage and open report
5858

5959
test-all: test ## Alias for 'test' target
6060

61-
test-only: ## Run all test suites with coverage (no browser)
62-
@echo "$(BOLD)$(BLUE)Running all test suites...$(RESET)"
61+
test-only: ## Run all test suites with coverage (no browser, in parallel)
62+
@echo "$(BOLD)$(BLUE)Running all test suites in parallel...$(RESET)"
63+
$(RUN_TESTS) --parallel
64+
65+
test-sequential: ## Run all test suites sequentially (no parallelization)
66+
@echo "$(BOLD)$(BLUE)Running all test suites sequentially...$(RESET)"
6367
$(RUN_TESTS)
6468

6569
test-fast: ## Run only fast test suites (api_tests, dont_disable_jit)
@@ -75,7 +79,7 @@ test-no-coverage: ## Run all tests without coverage collection
7579
$(RUN_TESTS) --no-coverage
7680

7781
# Individual test suite targets
78-
test-api: ## Run only API tests (tests/unit/api_tests)
82+
test-api: ## Run only API tests (tests/api_tests)
7983
@echo "$(BOLD)$(BLUE)Running API tests...$(RESET)"
8084
$(RUN_TESTS) --suite api_tests
8185

@@ -96,9 +100,9 @@ test-functional: ## Run functional/end-to-end tests
96100
$(RUN_TESTS) --suite functional
97101

98102

99-
test-all-suites: ## Run all test suites including functional tests
100-
@echo "$(BOLD)$(BLUE)Running all test suites including functional...$(RESET)"
101-
$(RUN_TESTS)
103+
test-all-suites: ## Run all test suites including functional tests (in parallel)
104+
@echo "$(BOLD)$(BLUE)Running all test suites including functional in parallel...$(RESET)"
105+
$(RUN_TESTS) --parallel
102106

103107
# Coverage targets
104108
coverage-report: ## Show coverage report in terminal

contributing.md

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Install the project requirements and the pre-commit framework:
55

66
```bash
77
pip install -r requirements.txt
8-
pip install pre-commit
98
```
109

1110
## Setting up Pre-Commit Hooks
@@ -36,7 +35,7 @@ this command to view linting results:
3635

3736
PyReason uses a unified test runner that handles multiple test configurations automatically. The test suite is organized into four directories:
3837

39-
- **`tests/unit/api_tests/`** - Tests for main pyreason.py API functions (JIT enabled, real pyreason)
38+
- **`tests/api_tests/`** - Tests for main pyreason.py API functions (JIT enabled, real pyreason)
4039
- **`tests/unit/disable_jit/`** - Tests for internal interpretation logic (JIT disabled, stubbed environment)
4140
- **`tests/unit/dont_disable_jit/`** - Tests for components that benefit from JIT (JIT enabled, lightweight stubs)
4241
- **`tests/functional/`** - End-to-end functional tests (JIT enabled, real pyreason, longer running)
@@ -57,33 +56,12 @@ make test-fast
5756
make coverage-html
5857
```
5958

60-
### Individual Test Suites
61-
62-
```bash
63-
# API tests (real pyreason, JIT enabled)
64-
make test-api
65-
66-
# JIT disabled tests (stubbed environment)
67-
make test-jit
68-
69-
# JIT enabled tests (lightweight stubs)
70-
make test-no-jit
71-
72-
# Consistency tests
73-
make test-consistency
74-
75-
# Functional/end-to-end tests
76-
make test-functional
77-
```
78-
7959
### Advanced Options
8060

8161
```bash
82-
# Run with parallel execution where possible
83-
make test-parallel
62+
# Run with sequential execution
63+
make make test-sequential
8464

85-
# Run without coverage collection (faster)
86-
python run_tests.py --no-coverage
8765

8866
# Run specific suites
8967
python run_tests.py --suite api_tests --suite dont_disable_jit
@@ -99,10 +77,7 @@ You can still run pytest directly on individual directories:
9977

10078
```bash
10179
# API tests
102-
pytest tests/unit/api_tests/ -v
103-
104-
# JIT disabled tests
105-
NUMBA_DISABLE_JIT=1 pytest tests/unit/disable_jit/ -v
80+
pytest tests/api_tests/ -v
10681

10782
# JIT enabled tests
10883
pytest tests/unit/dont_disable_jit/ -v
@@ -138,10 +113,3 @@ pytest tests/functional/test_hello_world.py -v
138113
# Clean up generated files
139114
make clean
140115
```
141-
142-
**Common Issues:**
143-
- **Functional tests fail with warnings**: The pytest.ini has been updated to ignore expected warnings from numba and networkx
144-
- **Tests time out**: Functional tests have longer timeouts (600s) and global timeout is disabled
145-
- **Import errors**: Ensure pytest and dependencies are installed with `make install-deps`
146-
147-
Running tests locally before committing or pushing helps catch issues early and speeds up code review. The unified test runner ensures consistent behavior across different development environments.

debug.py

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)