Skip to content

Commit 50b2692

Browse files
author
Fabien Coelho
committed
working external & internal tests on both apps
1 parent fadb2bf commit 50b2692

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

docs/documentation.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ import os
6969
import pytest
7070
from FlaskTester import ft_client, ft_authenticator
7171

72-
os.environ.update(
73-
FLASK_TESTER_ALLOW="basic param none",
74-
FLASK_TESTER_APP="app2:create_app",
75-
)
72+
os.environ.update(FLASK_TESTER_ALLOW="basic param none")
7673

7774
@pytest.fixture
7875
def app(ft_client):

tests/Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,29 @@ SEED := $(shell head -c 33 /dev/urandom | base64)
2121
check.external:
2222
source $(VENV)/bin/activate
2323
export TEST_SEED="$(SEED)"
24-
flask --app app:app run --port=$(PORT) &
24+
export FLASK_TESTER_URL="http://localhost:$(PORT)"
25+
# app
26+
flask --app app run --port=$(PORT) &
2527
flask_pid=$$!
2628
sleep $(SLEEP)
27-
export FLASK_TESTER_URL="http://localhost:$(PORT)"
2829
$(PYTEST) $(PYTOPT) test_app.py
2930
kill $$flask_pid
31+
# app2
32+
flask --app app2 run --port=$(PORT) &
33+
flask_pid=$$!
34+
sleep $(SLEEP)
35+
$(PYTEST) $(PYTOPT) test_app2.py
36+
kill $$flask_pid
3037

3138
.PHONY: check.internal
3239
check.internal:
3340
source $(VENV)/bin/activate
34-
$(PYTEST) $(PYTOPT) test_app2.py
41+
# app
3542
export FLASK_TESTER_APP="app"
3643
$(PYTEST) $(PYTOPT) test_app.py
44+
# app2
45+
export FLASK_TESTER_APP="app2:create_app"
46+
$(PYTEST) $(PYTOPT) test_app2.py
3747

3848
.PHONY: check.coverage
3949
check.coverage:

tests/test_app2.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
import pytest
33
from FlaskTester import ft_client, ft_authenticator
44

5-
# hardwired local test
6-
os.environ.update(
7-
FLASK_TESTER_ALLOW="basic param none",
8-
FLASK_TESTER_APP="app2:create_app",
9-
)
5+
os.environ.update(FLASK_TESTER_ALLOW="basic param none")
106

117
@pytest.fixture
128
def app(ft_client):

0 commit comments

Comments
 (0)