diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-09-16 09:09:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-09-16 09:09:35 +0000 |
commit | 0dfe1c9e2780469e3a4696e8fb3e6f717a7ebeb7 (patch) | |
tree | a0b651b55ea02e3b00bbc5eedba566fdd6bd7c08 /tests/test_examples.py | |
parent | Initial commit. (diff) | |
download | terminaltables-0dfe1c9e2780469e3a4696e8fb3e6f717a7ebeb7.tar.xz terminaltables-0dfe1c9e2780469e3a4696e8fb3e6f717a7ebeb7.zip |
Adding upstream version 3.1.0.upstream/3.1.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_examples.py')
-rw-r--r-- | tests/test_examples.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_examples.py b/tests/test_examples.py new file mode 100644 index 0000000..f0799f9 --- /dev/null +++ b/tests/test_examples.py @@ -0,0 +1,32 @@ +"""Test example scripts.""" + +from __future__ import print_function + +import os +import subprocess +import sys + +import pytest + +from tests import PROJECT_ROOT + + +@pytest.mark.parametrize('filename', map('example{0}.py'.format, (1, 2, 3))) +def test(filename): + """Test with subprocess. + + :param str filename: Example script filename to run. + """ + command = [sys.executable, str(PROJECT_ROOT.join(filename))] + env = dict(os.environ, PYTHONIOENCODING='utf-8') + + # Run. + proc = subprocess.Popen(command, env=env, stderr=subprocess.STDOUT, stdout=subprocess.PIPE) + output = proc.communicate()[0] + + # Verify. + try: + assert proc.poll() == 0 + except AssertionError: + print(output) + raise |