Skip to content

Commit 4452a3b

Browse files
committed
Pytest config
1 parent caa6a31 commit 4452a3b

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

autotest/GNUmakefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ all:
22
@echo "Run 'make -j test'"
33

44
gcore-test:
5-
python run_all.py gcore
5+
pytest gcore
66

77
gdrivers-test:
8-
python run_all.py gdrivers
8+
pytest gdrivers
99

1010
alg-test:
11-
python run_all.py alg
11+
pytest alg
1212

1313
osr-test:
14-
python run_all.py osr
14+
pytest osr
1515

1616
ogr-test:
17-
python run_all.py ogr
17+
pytest ogr
1818

1919
utilities-test:
20-
python run_all.py utilities
20+
pytest utilities
2121

2222
pyscripts-test:
23-
python run_all.py pyscripts
23+
pytest pyscripts
2424

2525
test check:
2626
@$(MAKE) $(MFLAGS) gcore-test gdrivers-test alg-test ogr-test osr-test utilities-test pyscripts-test

autotest/conftest.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# coding: utf-8
2+
from __future__ import absolute_import, division, print_function, unicode_literals
3+
4+
import os
5+
import sys
6+
7+
import pytest
8+
9+
sys.path.insert(0, "pymod")
10+
sys.path.insert(0, ".")
11+
12+
13+
@pytest.fixture(scope="module", autouse=True)
14+
def chdir_to_test_file(request):
15+
"""
16+
Changes to the same directory as the test file.
17+
Tests have grown to expect this.
18+
"""
19+
old = os.getcwd()
20+
21+
os.chdir(os.path.dirname(request.module.__file__))
22+
yield
23+
os.chdir(old)

autotest/pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
python_files = *.py
3+
testpaths = ogr gcore gdrivers osr alg gnm utilities pyscripts

0 commit comments

Comments
 (0)