Skip to content

Commit 5f311e0

Browse files
Oberon00c24t
authored andcommitted
Fix example tests on Win32 (open-telemetry#302)
1 parent eee7d84 commit 5f311e0

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

examples/basic_tracer/tests/test_tracer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@
1313
# limitations under the License.
1414
import os
1515
import subprocess
16+
import sys
1617
import unittest
1718

1819

1920
class TestBasicTracerExample(unittest.TestCase):
2021
def test_basic_tracer(self):
2122
dirpath = os.path.dirname(os.path.realpath(__file__))
2223
test_script = "{}/../tracer.py".format(dirpath)
23-
output = subprocess.check_output(test_script).decode()
24+
output = subprocess.check_output(
25+
(sys.executable, test_script)
26+
).decode()
2427

2528
self.assertIn('name="foo"', output)
2629
self.assertIn('name="bar"', output)

examples/http/tests/test_http.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414
import os
1515
import subprocess
16+
import sys
1617
import unittest
1718
from time import sleep
1819

@@ -22,13 +23,15 @@ class TestHttpExample(unittest.TestCase):
2223
def setup_class(cls):
2324
dirpath = os.path.dirname(os.path.realpath(__file__))
2425
server_script = "{}/../server.py".format(dirpath)
25-
cls.server = subprocess.Popen([server_script])
26+
cls.server = subprocess.Popen([sys.executable, server_script])
2627
sleep(1)
2728

2829
def test_http(self):
2930
dirpath = os.path.dirname(os.path.realpath(__file__))
3031
test_script = "{}/../tracer_client.py".format(dirpath)
31-
output = subprocess.check_output(test_script).decode()
32+
output = subprocess.check_output(
33+
(sys.executable, test_script)
34+
).decode()
3235
self.assertIn('name="/"', output)
3336

3437
@classmethod

0 commit comments

Comments
 (0)