Skip to content

Commit

Permalink
Add acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lothiraldan committed Aug 7, 2017
1 parent 76c55b3 commit cfb369c
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 0 deletions.
Empty file added acceptance/pytest.ini
Empty file.
82 changes: 82 additions & 0 deletions acceptance/test_class.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
class TestClassPassing(object):

def setup_method(self, method):
pass

def teardown_method(self, method):
pass

def test_passing(self):
assert True


class TestClassFailing(object):

def setup_method(self, method):
pass

def teardown_method(self, method):
pass

def test_failing(self):
assert False


class TestClassError(object):

def setup_method(self, method):
pass

def teardown_method(self, method):
pass

def test_error(self):
1/0


class TestClassFailingAndErrorTeardown(object):

def setup_method(self, method):
pass

def teardown_method(self, method):
1/0

def test_error(self):
assert False


class TestClassErrorSetup(object):

def setup_method(self, method):
1/0

def teardown_method(self, method):
pass

def test_passing(self):
assert True


class TestClassErrorSetupAndTeardown(object):

def setup_method(self, method):
1/0

def teardown_method(self, method):
1/0

def test_passing(self):
assert True


class TestClassErrorTeardown(object):

def setup_method(self, method):
pass

def teardown_method(self, method):
1/0

def test_passing(self):
assert True
18 changes: 18 additions & 0 deletions acceptance/test_func.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import pytest


def test_success():
assert True


def test_fails():
assert False


@pytest.mark.parametrize("number", list(range(3)))
def test_fixtures(number):
assert number % 2 == 0


def test_error():
1/0
38 changes: 38 additions & 0 deletions acceptance/test_module_setup_teardown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
def setup_module(module):
pass


def teardown_module(module):
print("TD MO")


def test_passing():
assert True


def test_failing():
assert False


class TestClassPassing(object):

def setup_method(self, method):
pass

def teardown_method(self, method):
pass

def test_passing(self):
assert True


class TestClassFailing(object):

def setup_method(self, method):
pass

def teardown_method(self, method):
print("TD M")

def test_failing(self):
assert False
4 changes: 4 additions & 0 deletions acceptance/test_random.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import random

def test_random():
assert random.randint(1, 2) == 1
22 changes: 22 additions & 0 deletions acceptance/test_skip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import pytest

@pytest.mark.skip(reason="Skip")
def test_skip_function():
pass


class TestSkipCall(object):

@pytest.mark.skip(reason="Skip")
def test_skip_method(self):
pass


@pytest.mark.skip(reason="Skip")
class TestSkipClass(object):

def test_skipped_1(self):
pass

def test_skipped_2(self):
pass
57 changes: 57 additions & 0 deletions acceptance/test_std.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import sys


def test_stdout():
print("STDOUT")


def test_stderr():
sys.stderr.write("STDERR\n")


class TestClassStdout(object):

def setup_method(self, method):
pass

def teardown_method(self, method):
pass

def test_stdout(self):
print("STDOUT")


class TestClassStdoutSetup(object):

def setup_method(self, method):
print("SETUP")

def teardown_method(self, method):
pass

def test_stdout(self):
pass


class TestClassStdoutAllPhases(object):

def setup_method(self, method):
print("SETUP")

def teardown_method(self, method):
print("TEARDOWN")

def test_stdout(self):
print("TEST")


class TestClassFailing(object):

def setup_method(self, method):
pass

def teardown_method(self, method):
pass

def test_stderr(self):
sys.stderr.write("STDERR\n")

0 comments on commit cfb369c

Please sign in to comment.