Skip to content

Commit 2adc015

Browse files
committed
refactor(test): use shared project fixture in unit tests
This commit refactors the unit tests for `ProjectFeatureFlag` and `ProjectFeatureFlagUserList` to use the shared `project` fixture from `conftest.py`. This change removes duplicated local fixture definitions, improving code consistency and maintainability, and addresses feedback from the pull request review.
1 parent c609130 commit 2adc015

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

tests/unit/objects/test_project_feature_flag_user_lists.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,8 @@
22
Unit tests for Project Feature Flag User Lists.
33
"""
44

5-
import pytest
65
import responses
76

8-
from gitlab import Gitlab
9-
10-
11-
@pytest.fixture
12-
def project():
13-
gl = Gitlab("http://localhost", private_token="private_token", api_version="4")
14-
return gl.projects.get(1, lazy=True)
15-
167

178
def test_create_user_list_with_list_conversion(project):
189
"""

tests/unit/objects/test_project_feature_flags.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,11 @@
22
Unit tests for Project Feature Flags.
33
"""
44

5-
import pytest
65
import responses
76

8-
from gitlab import Gitlab
97
from gitlab.v4.objects import ProjectFeatureFlag
108

119

12-
@pytest.fixture
13-
def project():
14-
gl = Gitlab("http://localhost", private_token="private_token", api_version="4")
15-
return gl.projects.get(1, lazy=True)
16-
17-
1810
def test_feature_flag_rename(project):
1911
"""
2012
Verify that renaming a feature flag uses the old name in the URL

tests/unit/test_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_lowercase_string_attribute_get_for_api():
124124
assert o.get_for_api(key="spam") == ("spam", "foo")
125125

126126

127-
# JSONAttribute tests
127+
# JsonAttribute tests
128128
def test_json_attribute() -> None:
129129
attr = types.JsonAttribute()
130130

0 commit comments

Comments
 (0)