Skip to content

Commit 0884e7c

Browse files
committed
Boot background flask app to test against.
1 parent 8df3cec commit 0884e7c

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

tests/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
from __future__ import absolute_import
12
import os
3+
import time
4+
import threading
25
import opentracing
36
import instana.tracer
7+
from .apps.flaskalino import app as flaskalino
48
os.environ["INSTANA_TEST"] = "true"
59

610
opentracing.global_tracer = instana.tracer.InstanaTracer()
11+
12+
# Spawn our background Flask app that the tests will throw
13+
# requests at. Don't continue until the test app is fully
14+
# up and running.
15+
timer = threading.Thread(target=flaskalino.run)
16+
timer.daemon = True
17+
timer.name = "Test Flask app"
18+
print("Starting background test app")
19+
timer.start()
20+
time.sleep(1)

tests/apps/__init__.py

Whitespace-only changes.

tests/apps/flaskalino.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
from flask import Flask
4+
app = Flask(__name__)
5+
app.debug = False
6+
app.use_reloader = False
7+
8+
9+
@app.route("/")
10+
def hello():
11+
return "<center><h1>🐍 Hello Stan! 🦄</h1></center>"
12+
13+
14+
if __name__ == '__main__':
15+
app.run()

0 commit comments

Comments
 (0)