Skip to content

Commit cc5dae7

Browse files
fix: pylint errors
1 parent c004f6b commit cc5dae7

File tree

6 files changed

+44
-27
lines changed

6 files changed

+44
-27
lines changed

tests/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

tests/test_api.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
"""Unit tests for Bitbucket API logic in manage_bitbucket_env.py."""
2-
from manage_bitbucket_env import get_environment_uuid, get_variables
32
import unittest
43
from unittest.mock import patch, Mock
5-
import sys
6-
import os
7-
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
4+
from typing import Optional
5+
6+
from manage_bitbucket_env import get_environment_uuid, get_variables
87

98
class TestAPI(unittest.TestCase):
109
"""Test API-related functions."""
10+
# pylint: disable=attribute-defined-outside-init
11+
logger: Optional[Mock] = None
12+
auth: Optional[Mock] = None
13+
workspace: Optional[str] = None
14+
repo_slug: Optional[str] = None
15+
deployment_name: Optional[str] = None
16+
env_uuid: Optional[str] = None
1117

1218
def setUp(self):
1319
"""Set up test fixtures."""
@@ -65,4 +71,4 @@ def test_get_variables(self, mock_get):
6571
self.assertEqual(result_vars[0]["key"], "A")
6672

6773
if __name__ == '__main__':
68-
unittest.main()
74+
unittest.main()

tests/test_arg_parser.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"""Unit tests for argument parsing in manage_bitbucket_env.py."""
2-
from manage_bitbucket_env import arg_parser
32
import unittest
43
from unittest.mock import patch
54
import sys
6-
import os
7-
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
5+
6+
from manage_bitbucket_env import arg_parser
87

98
class TestArgParser(unittest.TestCase):
109
"""Test argument parsing functionality."""
@@ -40,4 +39,4 @@ def test_mutually_exclusive(self):
4039
arg_parser()
4140

4241
if __name__ == '__main__':
43-
unittest.main()
42+
unittest.main()

tests/test_export_import.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
"""Unit tests for export/import logic in manage_bitbucket_env.py."""
22
# pylint: disable=duplicate-code
3-
from manage_bitbucket_env import (
4-
export_variables, export_all_variables, export_secure_keys, import_variables
5-
)
63
import unittest
74
from unittest.mock import patch, Mock
8-
import sys
95
import os
106
import tempfile
117
import json
12-
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
8+
from typing import Optional
9+
10+
from manage_bitbucket_env import (
11+
export_variables, export_all_variables, export_secure_keys, import_variables
12+
)
1313

1414
class TestExportImport(unittest.TestCase):
1515
"""Test export and import functionality."""
16+
# pylint: disable=attribute-defined-outside-init
17+
logger: Optional[Mock] = None
18+
auth: Optional[Mock] = None
19+
workspace: Optional[str] = None
20+
repo_slug: Optional[str] = None
21+
deployment_name: Optional[str] = None
22+
env_uuid: Optional[str] = None
1623

1724
def setUp(self):
1825
"""Set up test fixtures."""
@@ -125,4 +132,4 @@ def test_import_variables(self, mock_update, mock_get_vars, mock_get_uuid):
125132
os.unlink(fname)
126133

127134
if __name__ == '__main__':
128-
unittest.main()
135+
unittest.main()

tests/test_main.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
"""Unit tests for main function integration in manage_bitbucket_env.py."""
22
# pylint: disable=unused-argument
3-
from manage_bitbucket_env import main
43
import unittest
54
from unittest.mock import patch, Mock
6-
import sys
7-
import os
8-
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
5+
from typing import Optional
6+
7+
from manage_bitbucket_env import main
98

109
class TestMainFunction(unittest.TestCase):
1110
"""Test main function integration."""
11+
# pylint: disable=attribute-defined-outside-init
12+
mock_logger: Optional[Mock] = None
1213

1314
def setUp(self):
1415
"""Set up test fixtures."""
15-
self.mock_logger: Mock = Mock()
16+
self.mock_logger = Mock()
1617

1718
@patch('manage_bitbucket_env.arg_parser')
1819
@patch('manage_bitbucket_env.load_dotenv')
@@ -59,4 +60,4 @@ def test_main_missing_credentials(self, mock_env_get, mock_load_dotenv, mock_arg
5960
main(self.mock_logger)
6061

6162
if __name__ == '__main__':
62-
unittest.main()
63+
unittest.main()

tests/test_update_vars.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
"""Unit tests for update_vars logic in manage_bitbucket_env.py."""
22
# pylint: disable=duplicate-code
3-
from manage_bitbucket_env import update_vars
43
import unittest
54
from unittest.mock import patch, Mock
6-
import sys
7-
import os
8-
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
5+
from typing import Optional
6+
7+
from manage_bitbucket_env import update_vars
98

109
class TestUpdateVars(unittest.TestCase):
1110
"""Test variable update functionality."""
11+
# pylint: disable=attribute-defined-outside-init
12+
logger: Optional[Mock] = None
13+
auth: Optional[Mock] = None
14+
workspace: Optional[str] = None
15+
repo_slug: Optional[str] = None
16+
env_uuid: Optional[str] = None
1217

1318
def setUp(self):
1419
"""Set up test fixtures."""
@@ -49,4 +54,4 @@ def test_update_new(self, mock_post):
4954
mock_post.assert_called_once()
5055

5156
if __name__ == '__main__':
52-
unittest.main()
57+
unittest.main()

0 commit comments

Comments
 (0)