Skip to content

Commit

Permalink
Removed python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
tolstislon committed Jan 10, 2024
1 parent 048dfd7 commit eb870cc
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion testrail_api/_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/test_groups.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import responses
import json

import pytest
import responses


def get_group(r):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_milestone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'}]}
)


Expand Down
3 changes: 1 addition & 2 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
12 changes: 7 additions & 5 deletions tests/test_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 8 additions & 6 deletions tests/test_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 5 additions & 2 deletions tests/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
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'):
assert r.params['limit'] == limit
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):
Expand Down Expand Up @@ -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')
Expand Down
4 changes: 3 additions & 1 deletion tests/test_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
29 changes: 15 additions & 14 deletions tests/test_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit eb870cc

Please sign in to comment.