Skip to content

Commit e3492bd

Browse files
committed
execute only a small subset of tests for PG_BIN and PG_CONFIG
1 parent b417418 commit e3492bd

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dist
2+
env
3+
venv
4+
*.egg-info

run_tests.sh

+8-6
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ time coverage run -a tests/test_simple.py
4242

4343

4444
# run tests (PG_BIN)
45-
export PG_BIN=$(dirname $(which pg_config))
46-
time coverage run -a tests/test_simple.py
47-
unset PG_BIN
45+
time \
46+
PG_BIN=$(dirname $(which pg_config)) \
47+
ALT_CONFIG=1 \
48+
coverage run -a tests/test_simple.py
4849

4950

5051
# run tests (PG_CONFIG)
51-
export PG_CONFIG=$(which pg_config)
52-
time coverage run -a tests/test_simple.py
53-
unset PG_CONFIG
52+
time \
53+
PG_CONFIG=$(which pg_config) \
54+
ALT_CONFIG=1 \
55+
coverage run -a tests/test_simple.py
5456

5557

5658
# show coverage

tests/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export PG_BIN=/path/to/pg/bin
2121

2222
```bash
2323
# Set path to PostgreSQL and python version
24-
export PATH=$PATH:/path/to/pg/bin
24+
export PATH=/path/to/pg/bin:$PATH
2525
export PYTHON_VERSION=3 # or 2
2626

2727
# Run tests

tests/test_simple.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def removing(f):
6969
os.remove(f)
7070

7171

72-
class SimpleTest(unittest.TestCase):
72+
class TestgresTests(unittest.TestCase):
7373
def test_custom_init(self):
7474
with get_new_node() as node:
7575
# enable page checksums
@@ -757,4 +757,21 @@ def test_child_pids(self):
757757

758758

759759
if __name__ == '__main__':
760-
unittest.main()
760+
if os.environ.get('ALT_CONFIG'):
761+
suite = unittest.TestSuite()
762+
763+
# Small subset of tests for alternative configs (PG_BIN or PG_CONFIG)
764+
suite.addTest(TestgresTests('test_pg_config'))
765+
suite.addTest(TestgresTests('test_pg_ctl'))
766+
suite.addTest(TestgresTests('test_psql'))
767+
suite.addTest(TestgresTests('test_replicate'))
768+
769+
print('Running tests for alternative config:')
770+
for t in suite:
771+
print(t)
772+
print()
773+
774+
runner = unittest.TextTestRunner()
775+
runner.run(suite)
776+
else:
777+
unittest.main()

0 commit comments

Comments
 (0)