Skip to content

Commit 9164291

Browse files
authored
Merge pull request #62 from UpCloudLtd/feature-update-templates
pytest update travis test
2 parents 8c5a5d4 + 3cd1e99 commit 9164291

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pytest>=2.9.2
1+
pytest==4.1
22
py>=1.4.26
33
mock>=1.0.1
44
responses==0.3.0

test/test_integration/test_integration_test.py

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,10 @@
2121
PASSWORD = os.environ.get('UPCLOUD_API_PASSWD')
2222

2323

24-
def pytest_addoption(parser):
25-
parser.addoption(
26-
"--integration-tests", action="store_true", default=False, help="run integration tests"
27-
)
28-
29-
30-
def pytest_configure(config):
31-
config.addinivalue_line("markers", "interagtion: mark test as integration")
32-
33-
34-
def pytest_collection_modifyitems(config, items):
35-
if config.getoption("--integration-tests"):
36-
# --integration-tests given in cli: do not skip integration tests
37-
return
38-
integration_tests = pytest.mark.skip(reason="need --integration-tests option to run")
39-
for item in items:
40-
if "integration_test" in item.keywords:
41-
item.add_marker(integration_tests)
24+
integration_test = pytest.mark.skipif(
25+
not pytest.config.getoption('--integration-tests'),
26+
reason='need --integration-tests option to run'
27+
)
4228

4329

4430
# globals to store created resources so we can cleanup after tests
@@ -56,7 +42,7 @@ def delete_tag(tag):
5642
tag.destroy()
5743

5844

59-
@pytest.mark.integration_test
45+
@integration_test
6046
def teardown_module(module):
6147
manager = CloudManager(USERNAME, PASSWORD, timeout=160)
6248

@@ -75,7 +61,7 @@ def teardown_module(module):
7561
manager.delete_tag(tag)
7662

7763

78-
@pytest.mark.integration_test
64+
@integration_test
7965
def test_infra_ops():
8066
global CREATED_SERVERS
8167
global CREATED_TAGS

0 commit comments

Comments
 (0)