Skip to content

Commit aa5f109

Browse files
authored
fix: remove pytest-depends from project (#27)
1 parent 250756c commit aa5f109

File tree

7 files changed

+28
-55
lines changed

7 files changed

+28
-55
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ coverage.xml
5151

5252
# virtual env
5353
venv/
54+
venv*/
5455
# python 3 virtual env
5556
python3/
5657

case_management.env.enc

0 Bytes
Binary file not shown.

requirements-dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ python_dotenv>=0.1.5
55
pylint>=1.4.4
66
tox>=2.9.1
77
pytest-rerunfailures>=3.1
8-
pytest-depends>=1.0.1
98

109
# code coverage
1110
coverage<5

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ jproperties
22
requests>=2.0,<3.0
33
python_dateutil>=2.5.3
44
websocket-client==0.48.0
5-
ibm_cloud_sdk_core>=2.0.0,<3.0.0
5+
ibm_cloud_sdk_core>=2.0.1,<3.0.0

test/integration/test_case_management_v1.py

Lines changed: 22 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@
2828

2929
# Read config file
3030
configFile = 'case_management.env'
31-
configLoaded = None
32-
33-
if os.path.exists(configFile):
34-
os.environ['IBM_CREDENTIALS_FILE'] = configFile
35-
configLoaded = True
3631

3732
class TestCaseManagementV1(unittest.TestCase):
3833

@@ -42,23 +37,18 @@ class TestCaseManagementV1(unittest.TestCase):
4237
file_attachment_id = ''
4338

4439
@classmethod
45-
def setUpClass(self):
46-
47-
if not configLoaded:
40+
def setUpClass(cls):
41+
if os.path.exists(configFile):
42+
os.environ['IBM_CREDENTIALS_FILE'] = configFile
43+
else:
4844
raise unittest.SkipTest('External configuration not available, skipping...')
4945

50-
self.service = CaseManagementV1.new_instance()
51-
assert self.service is not None
52-
53-
self.config = read_external_sources(CaseManagementV1.DEFAULT_SERVICE_NAME)
54-
assert self.config is not None
55-
self.test_api_key = self.config.get('APIKEY')
56-
assert self.test_api_key is not None
46+
cls.service = CaseManagementV1.new_instance()
47+
assert cls.service is not None
5748

58-
print('\nSetup complete.')
49+
print('Setup complete.')
5950

60-
@pytest.mark.depends(name='case_creation')
61-
def test_create_case(self):
51+
def test_01_create_case(self):
6252

6353
# Offering info can be retrieved via /case-management/utilities/v1/offerings/technical
6454
offering_payload_type_model = {}
@@ -92,7 +82,7 @@ def test_create_case(self):
9282
assert subject == response.result['short_description']
9383
assert description == response.result['description']
9484

95-
def test_create_case_with_empty_offering(self):
85+
def test_02_create_case_with_empty_offering(self):
9686

9787
type = 'technical'
9888
subject = 'Python - Integration test'
@@ -109,7 +99,7 @@ def test_create_case_with_empty_offering(self):
10999
)
110100
assert e.value.code == 400
111101

112-
def test_create_case_with_empty_subject_and_description(self):
102+
def test_03_create_case_with_empty_subject_and_description(self):
113103

114104
# Offering info can be retrieved via /case-management/utilities/v1/offerings/technical
115105
offering_payload_type_model = {}
@@ -139,8 +129,7 @@ def test_create_case_with_empty_subject_and_description(self):
139129
)
140130
assert e.value.code == 500
141131

142-
@pytest.mark.depends(on='case_creation')
143-
def test_get_cases(self):
132+
def test_04_get_cases(self):
144133

145134
offset = 0
146135
limit = 2
@@ -158,8 +147,7 @@ def test_get_cases(self):
158147
assert response.status_code == 200
159148
assert response.result['total_count'] > 0
160149

161-
@pytest.mark.depends(on='case_creation')
162-
def test_get_case(self):
150+
def test_05_get_case(self):
163151

164152
fields = ['number', 'short_description']
165153
case_number = TestCaseManagementV1.new_case_number
@@ -173,7 +161,7 @@ def test_get_case(self):
173161
assert TestCaseManagementV1.new_case_number == response.result['number']
174162
assert response.result['short_description'] != ''
175163

176-
def test_get_case_with_invalid_field(self):
164+
def test_06_get_case_with_invalid_field(self):
177165

178166
fields = ['number', 'short_description', 'invalid_field']
179167
case_number = TestCaseManagementV1.new_case_number
@@ -186,8 +174,7 @@ def test_get_case_with_invalid_field(self):
186174
)
187175
assert e.value.code == 400
188176

189-
@pytest.mark.depends(on='case_creation')
190-
def test_add_comment(self):
177+
def test_07_add_comment(self):
191178

192179
case_number = TestCaseManagementV1.new_case_number
193180
comment = 'This is a test comment!'
@@ -201,7 +188,7 @@ def test_add_comment(self):
201188
assert response.status_code == 200
202189
assert comment == response.result["value"]
203190

204-
def test_add_comment_to_nonexisting_case(self):
191+
def test_08_add_comment_to_nonexisting_case(self):
205192

206193
case_number = 'fake-case-number'
207194
comment = 'This is a test comment!'
@@ -214,8 +201,7 @@ def test_add_comment_to_nonexisting_case(self):
214201
)
215202
assert e.value.code == 404
216203

217-
@pytest.mark.depends(on='case_creation')
218-
def test_add_watch_list_member(self):
204+
def test_09_add_watch_list_member(self):
219205

220206
# Users can be retrieved via the User Management API.
221207
user_id_and_realm_model = {}
@@ -239,9 +225,7 @@ def test_add_watch_list_member(self):
239225
if user['user_id'] == user_id_and_realm_model['user_id']]
240226
assert len(found_users) == 1
241227

242-
@pytest.mark.depends(on='case_creation')
243-
@pytest.mark.depends(name='file_upload')
244-
def test_file_upload(self):
228+
def test_10_file_upload(self):
245229

246230
fileName = "test_file.txt"
247231

@@ -262,9 +246,7 @@ def test_file_upload(self):
262246
assert response.status_code == 200
263247
assert response.result['filename'] == fileName
264248

265-
@pytest.mark.depends(on='file_upload')
266-
@pytest.mark.depends(name='file_download')
267-
def test_download_file(self):
249+
def test_11_download_file(self):
268250

269251
response = self.service.download_file(
270252
TestCaseManagementV1.new_case_number,
@@ -275,8 +257,7 @@ def test_download_file(self):
275257
assert response.status_code == 200
276258
assert 'content-type' in response.headers
277259

278-
@pytest.mark.depends(on='file_download')
279-
def test_delete_file(self):
260+
def test_12_delete_file(self):
280261

281262
response = self.service.delete_file(
282263
TestCaseManagementV1.new_case_number,
@@ -288,9 +269,7 @@ def test_delete_file(self):
288269
# Assert the file attachment list is empty
289270
assert len(response.result['attachments']) == 0
290271

291-
@pytest.mark.depends(on='file_download')
292-
@pytest.mark.depends(name='add_resource')
293-
def test_add_resource(self):
272+
def test_13_add_resource(self):
294273

295274
# Adding a resource requires a valid CRN (Cloud Resource Name)
296275
# CRN's can be retrieved via the Search and Tagging API
@@ -310,8 +289,7 @@ def test_add_resource(self):
310289
)
311290
assert e.value.code == 500
312291

313-
@pytest.mark.depends(on='add_resource')
314-
def test_resolve_case(self):
292+
def test_14_resolve_case(self):
315293

316294
status_payload = {}
317295
status_payload['action'] = 'resolve'
@@ -325,4 +303,4 @@ def test_resolve_case(self):
325303
)
326304

327305
assert response.status_code == 200
328-
assert TestCaseManagementV1.new_case_number == response.result["number"]
306+
assert TestCaseManagementV1.new_case_number == response.result["number"]

test/integration/test_iam_access_groups_v2.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,13 @@
2929

3030
# Read config file
3131
configFile = 'iam_access_groups.env'
32-
configLoaded = None
33-
34-
if os.path.exists(configFile):
35-
os.environ['IBM_CREDENTIALS_FILE'] = configFile
36-
configLoaded = True
37-
else:
38-
print('External configuration was not found, skipping tests...')
3932

4033
class TestIamAccessGroupsV2(unittest.TestCase):
4134
@classmethod
4235
def setUpClass(cls):
43-
if not configLoaded:
36+
if os.path.exists(configFile):
37+
os.environ['IBM_CREDENTIALS_FILE'] = configFile
38+
else:
4439
raise unittest.SkipTest('External configuration not available, skipping...')
4540

4641
cls.service = IamAccessGroupsV2.new_instance()

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ commands = pylint --rcfile=.pylintrc ibm_platform_services test
99
[testenv]
1010
passenv = TOXENV CI TRAVIS*
1111
commands =
12-
py.test --reruns 3 --cov=ibm_platform_services {posargs}
12+
py.test --reruns 2 --cov=ibm_platform_services {posargs}
1313
codecov -e TOXENV
1414
deps =
1515
-r{toxinidir}/requirements.txt

0 commit comments

Comments
 (0)