-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtests.py
38 lines (33 loc) · 1.54 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
from subprocess import Popen, PIPE
from unittest import TestCase
example_directory = os.path.join(
os.path.dirname(__file__),
'example_tox_config')
class TestEnvironmentsAreCorrect(TestCase):
def test_environment_py_27_1(self):
command_args = [
'tox', '-e', 'py27-1', '--run-command',
'echo "Current environment: {envname}"']
process = Popen(command_args, stdin=PIPE, stdout=PIPE, stderr=PIPE,
cwd=example_directory)
stdout, stderr = process.communicate()
self.assertIn("Current environment: py27-1", stdout)
self.assertNotIn("Current environment: py27-2", stdout)
def test_environment_py_27_2(self):
command_args = [
'tox', '-e', 'py27-2', '--run-command',
'echo "Current environment: {envname}"']
process = Popen(command_args, stdin=PIPE, stdout=PIPE, stderr=PIPE,
cwd=example_directory)
stdout, stderr = process.communicate()
self.assertNotIn("Current environment: py27-1", stdout)
self.assertIn("Current environment: py27-2", stdout)
def test_environment_py_27_all(self):
command_args = [
'tox', '--run-command', 'echo "Current environment: {envname}"']
process = Popen(command_args, stdin=PIPE, stdout=PIPE, stderr=PIPE,
cwd=example_directory)
stdout, stderr = process.communicate()
self.assertIn("Current environment: py27-1", stdout)
self.assertIn("Current environment: py27-2", stdout)