From eb870ccb15395d6dc8ed8351f5a483252d1ec665 Mon Sep 17 00:00:00 2001 From: tolstislon Date: Wed, 10 Jan 2024 14:10:06 +0300 Subject: [PATCH] Removed python 3.7 --- .github/workflows/python-package.yml | 2 +- Pipfile | 6 +++--- setup.py | 3 +-- testrail_api/_category.py | 2 +- tests/test_groups.py | 3 ++- tests/test_milestone.py | 3 ++- tests/test_other.py | 3 +-- tests/test_plans.py | 12 +++++++----- tests/test_reports.py | 14 ++++++++------ tests/test_results.py | 7 +++++-- tests/test_runs.py | 4 +++- tests/test_sections.py | 29 ++++++++++++++-------------- 12 files changed, 49 insertions(+), 39 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 7b98cdc..bfecd5b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev" ] + python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ] steps: - uses: actions/checkout@v3 diff --git a/Pipfile b/Pipfile index 207e2a5..cc7da62 100644 --- a/Pipfile +++ b/Pipfile @@ -4,11 +4,11 @@ url = "https://pypi.org/simple" verify_ssl = true [dev-packages] -pytest = "==7.4.2" +pytest = "==7.4.4" pytest-cov = "==4.1.0" responses = "==0.21.0" -black = "==23.9.1" -flake8 = "==6.1.0" +black = "==23.12.1" +flake8 = "==7.0.0" pep8-naming = "==0.13.3" twine = "==4.0.2" diff --git a/setup.py b/setup.py index da834dd..08a980e 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ use_scm_version={"write_to": "testrail_api/__version__.py"}, setup_requires=["setuptools_scm==7.1.0"], install_requires=["requests>=2.20.1"], - python_requires=">=3.7", + python_requires=">=3.8", include_package_data=True, keywords=[ "testrail", @@ -37,7 +37,6 @@ "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", diff --git a/testrail_api/_category.py b/testrail_api/_category.py index 30936ee..efe91a9 100644 --- a/testrail_api/_category.py +++ b/testrail_api/_category.py @@ -485,7 +485,7 @@ def update_cases(self, case_ids: List[int], suite_id: int, **kwargs) -> dict: :param suite_id: The ID of the suite - :case_ids: List[int] + :param case_ids: List[int] The IDs of the test cases to update with the kwargs :param kwargs: :key title: str diff --git a/tests/test_groups.py b/tests/test_groups.py index 9190e8d..fec97c8 100644 --- a/tests/test_groups.py +++ b/tests/test_groups.py @@ -1,6 +1,7 @@ -import responses import json + import pytest +import responses def get_group(r): diff --git a/tests/test_milestone.py b/tests/test_milestone.py index 4c46cf6..07fdff7 100644 --- a/tests/test_milestone.py +++ b/tests/test_milestone.py @@ -17,7 +17,8 @@ def get_milestones(r): req = r.params assert req['is_started'] == '1' return 200, {}, json.dumps( - {"offset": 250, "limit": 250, "size": 1, "milestones": [{'id': 1, 'name': 'Milestone 1', 'description': 'My new milestone'}]} + {"offset": 250, "limit": 250, "size": 1, + "milestones": [{'id': 1, 'name': 'Milestone 1', 'description': 'My new milestone'}]} ) diff --git a/tests/test_other.py b/tests/test_other.py index acd7c4a..2c9e69a 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -24,8 +24,7 @@ def __call__(self, r): if self.last == 0 or now - self.last < 3: self.last = now return 429, {}, '' - else: - return 200, {}, json.dumps({'count': self.count}) + return 200, {}, json.dumps({'count': self.count}) class CustomException(Exception): diff --git a/tests/test_plans.py b/tests/test_plans.py index efd76ca..d2fcd9b 100644 --- a/tests/test_plans.py +++ b/tests/test_plans.py @@ -167,15 +167,17 @@ def test_delete_run_from_plan_entry(api, mock, url): ) api.plans.delete_run_from_plan_entry(2) + def test_get_plans_bulk(api, mock, url): mock.add_callback( responses.GET, url('get_plans/1'), get_plans, ) - resp = api.plans.get_plans_bulk(1, - is_completed=True, - created_after=datetime.now(), - created_before=datetime.now(), - ) + resp = api.plans.get_plans_bulk( + 1, + is_completed=True, + created_after=datetime.now(), + created_before=datetime.now(), + ) assert resp[0]['id'] == 5 diff --git a/tests/test_reports.py b/tests/test_reports.py index b16f80f..5c7d5f9 100644 --- a/tests/test_reports.py +++ b/tests/test_reports.py @@ -4,20 +4,22 @@ def test_get_reports(api, mock, url): + project_id = 1 mock.add_callback( responses.GET, - url('get_reports/1'), + url(f'get_reports/{project_id}'), lambda x: (200, {}, json.dumps([{'id': 1, 'name': 'Activity Summary'}])) ) - response = api.reports.get_reports(1) + response = api.reports.get_reports(project_id) assert response[0]['name'] == 'Activity Summary' def test_run_report(api, mock, url): + report_url, report_template_id = 'https://...383', 1 mock.add_callback( responses.GET, - url('run_report/1'), - lambda x: (200, {}, json.dumps({'report_url': 'https://...383'})) + url(f'run_report/{report_template_id}'), + lambda x: (200, {}, json.dumps({'report_url': report_url})) ) - response = api.reports.run_report(1) - assert response['report_url'] == 'https://...383' + response = api.reports.run_report(report_template_id) + assert response['report_url'] == report_url diff --git a/tests/test_results.py b/tests/test_results.py index 4d104b8..5fa8f6d 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -10,7 +10,8 @@ def get_results(r, limit='3'): assert r.params['limit'] == limit assert r.params['status_id'] == '1,2,3' - return 200, {}, json.dumps({"offset": 0, "limit": 250, "size": 1, "results":[{'id': 1, 'status_id': 2, 'test_id': 1}]}) + return 200, {}, json.dumps( + {"offset": 0, "limit": 250, "size": 1, "results": [{'id': 1, 'status_id': 2, 'test_id': 1}]}) def get_results_for_run(r, limit='3'): @@ -18,7 +19,8 @@ def get_results_for_run(r, limit='3'): assert r.params['status_id'] == '1,2,3' for key in 'created_after', 'created_before': assert re.match(r'^\d+$', r.params[key]) - return 200, {}, json.dumps({"offset": 0, "limit": 250, "size": 1, "results":[{'id': 1, 'status_id': 2, 'test_id': 1}]}) + return 200, {}, json.dumps( + {"offset": 0, "limit": 250, "size": 1, "results": [{'id': 1, 'status_id': 2, 'test_id': 1}]}) def add_result(r): @@ -117,6 +119,7 @@ def test_add_results_for_cases(api, mock, url): resp = api.results.add_results_for_cases(18, results) assert resp == results + @pytest.mark.parametrize('status_id', ('1,2,3', [1, 2, 3])) def test_get_results_bulk(api, mock, url, status_id): get_results_bulk = functools.partial(get_results, limit='250') diff --git a/tests/test_runs.py b/tests/test_runs.py index 776638f..b052935 100644 --- a/tests/test_runs.py +++ b/tests/test_runs.py @@ -15,10 +15,11 @@ def get_runs(r): "offset": 0, "limit": 250, "size": 1, - "runs":[{'id': 1, 'name': 'My run', 'is_completed': r.params['is_completed']}] + "runs": [{'id': 1, 'name': 'My run', 'is_completed': r.params['is_completed']}] } ) + def add_run(r): data = json.loads(r.body.decode()) return 200, {}, json.dumps( @@ -94,6 +95,7 @@ def test_delete_run(api, mock, url): resp = api.runs.delete_run(2) assert resp is None + @pytest.mark.parametrize('is_completed', (1, True)) def test_get_runs_bulk(api, mock, url, is_completed): mock.add_callback( diff --git a/tests/test_sections.py b/tests/test_sections.py index 14e3e4e..546ba68 100644 --- a/tests/test_sections.py +++ b/tests/test_sections.py @@ -25,14 +25,14 @@ def test_get_sections(api, mock, url): responses.GET, url('get_sections/5'), lambda x: (200, {}, json.dumps( - { - 'offset': 0, - 'limit': 250, - 'size': 1, - 'sections':[{'depth': 1, 'description': 'My section'}], - } - ) + { + 'offset': 0, + 'limit': 250, + 'size': 1, + 'sections': [{'depth': 1, 'description': 'My section'}], + } ) + ) ) resp = api.sections.get_sections(5, suite_id=2).get('sections') assert resp[0]['depth'] == 1 @@ -82,19 +82,20 @@ def test_move_section(api, mock, url): assert resp['parent_id'] == 3 assert resp['after_id'] == 5 + def test_get_sections_bulk(api, mock, url): mock.add_callback( responses.GET, url('get_sections/5'), lambda x: (200, {}, json.dumps( - { - 'offset': 0, - 'limit': 250, - 'size': 1, - 'sections':[{'depth': 1, 'description': 'My section'}], - } - ) + { + 'offset': 0, + 'limit': 250, + 'size': 1, + 'sections': [{'depth': 1, 'description': 'My section'}], + } ) + ) ) resp = api.sections.get_sections_bulk(5, suite_id=2) assert resp[0]['depth'] == 1