Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from gregoil/feature/python3-sanity-tests
Feature/python3 sanity tests
- Loading branch information
Showing
16 changed files
with
90 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Integration tests validate that a rotest project is usable.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from __future__ import absolute_import, print_function | ||
|
||
from rotest import main | ||
from rotest.core import TestBlock, TestFlow | ||
|
||
|
||
class ExampleBlock1(TestBlock): | ||
__test__ = False | ||
|
||
# pylint: disable=no-self-use | ||
def test_method(self): | ||
print("ExampleBlock1 ran") | ||
|
||
|
||
class ExampleBlock2(TestBlock): | ||
__test__ = False | ||
|
||
# pylint: disable=no-self-use | ||
def test_method(self): | ||
print("ExampleBlock2 ran") | ||
|
||
|
||
class ExampleFlow(TestFlow): | ||
__test__ = False | ||
|
||
blocks = [ | ||
ExampleBlock1, | ||
ExampleBlock2 | ||
] | ||
|
||
|
||
if __name__ == "__main__": | ||
main(ExampleFlow) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import os | ||
import sys | ||
|
||
import subprocess | ||
|
||
THIS_FILE = os.path.abspath(__file__) | ||
THIS_DIRECTORY = os.path.dirname(THIS_FILE) | ||
ROTEST_WORK_DIR = os.path.join(os.path.expanduser("~"), ".rotest") | ||
|
||
|
||
def test_sanity(): | ||
python = sys.executable | ||
playground = os.path.join(THIS_DIRECTORY, "playground.py") | ||
environment_variables = dict( | ||
os.environ, | ||
DJANGO_SETTINGS_MODULE="rotest.common.django_utils.settings", | ||
ROTEST_WORK_DIR=ROTEST_WORK_DIR | ||
) | ||
|
||
p = subprocess.Popen([python, playground], env=environment_variables, | ||
stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
|
||
return_code = p.wait() | ||
stderr = p.stderr.read() | ||
stdout = p.stdout.read() | ||
assert b"Test run has started" in stderr | ||
assert b'ExampleBlock1 ran' in stdout | ||
assert b'ExampleBlock2 ran' in stdout | ||
assert return_code == 0 |