Skip to content

Commit 14b5af5

Browse files
committed
Add profiling test
1 parent 0ed8d4d commit 14b5af5

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ dev = [
1515
"ruff>=0.11.4",
1616
"pytest>=7.0",
1717
"pytest-profiling",
18+
"flameprof",
1819
]
1920

2021
[tool.pytest.ini_options]
2122
testpaths = ["tests"]
2223
python_files = "test_*.py"
23-
addopts = "-v"
24+
addopts = "-v -m 'not profiling'"

tests/profiling/test_profiling.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Test(s) to use with pytest-profiling to identify bottlenecks in the code."""
2+
import pytest
3+
4+
@pytest.mark.profiling
5+
def test_profiling(monkeypatch):
6+
7+
# Define the command line arguments
8+
import sys
9+
argv = ['dementpy.py', 'grassland', 'output', '20250402', 'scrubland']
10+
monkeypatch.setattr(sys, 'argv', argv)
11+
12+
# Move to subfolder so input and output folders will be correct
13+
import os
14+
os.chdir('src')
15+
16+
# Run dementpy
17+
import dementpy
18+
dementpy.main()

0 commit comments

Comments
 (0)