Moved from xdist to normal pytest. Removed test folder from openapi_client
Some checks failed
checks-impure / test (pull_request) Successful in 32s
checks / test (pull_request) Failing after 3m9s

This commit is contained in:
2024-01-08 20:37:17 +01:00
parent e22e954a4a
commit acb84b8f0b
20 changed files with 6 additions and 889 deletions

View File

@@ -80,6 +80,8 @@ def main() -> None:
replacement = "from typing import Any, List, Optional, Dict"
replace_in_directory(directory_path=src_client, pattern=pattern, replacement=replacement)
src_clients_tests = src_client / "test"
shutil.rmtree(src_clients_tests)
dst_client: Path = args.out / "openapi_client"
shutil.rmtree(dst_client, ignore_errors=True)
shutil.copytree(src_client, dst_client)

View File

@@ -8,7 +8,6 @@
, openssh
, pytest
, pytest-cov
, pytest-xdist
, pytest-subprocess
, pytest-timeout
, remote-pdb
@@ -56,7 +55,6 @@ let
pytest
pytest-cov
pytest-subprocess
pytest-xdist
pytest-timeout
remote-pdb
ipdb

View File

@@ -21,7 +21,7 @@ testpaths = "tests"
faulthandler_timeout = 60
log_level = "DEBUG"
log_format = "%(levelname)s: %(message)s"
addopts = "--cov . --cov-report term --cov-report html:.reports/html --no-cov-on-fail --durations 5 --color=yes --maxfail=1 --new-first -nauto" # Add --pdb for debugging
addopts = "--cov . --cov-report term --cov-report html:.reports/html --no-cov-on-fail --durations 5 --color=yes --maxfail=1 --new-first" # Add --pdb for debugging
norecursedirs = "tests/helpers"
markers = [ "impure" ]

View File

@@ -14,7 +14,7 @@ from ports import PortFunction
from clan_cli.webui.app import app
@pytest.fixture()
@pytest.fixture(scope="session")
def test_client() -> TestClient:
return TestClient(app)
@@ -31,7 +31,7 @@ def get_health(*, url: str, max_retries: int = 20, delay: float = 0.2) -> str |
# Pytest fixture to run the server in a separate process
@pytest.fixture()
@pytest.fixture(scope="session")
def server_url(unused_tcp_port: PortFunction) -> Generator[str, None, None]:
port = unused_tcp_port()
host = "127.0.0.1"
@@ -52,7 +52,7 @@ def server_url(unused_tcp_port: PortFunction) -> Generator[str, None, None]:
proc.terminate()
@pytest.fixture()
@pytest.fixture(scope="session")
def api_client(server_url: str) -> Generator[ApiClient, None, None]:
configuration = Configuration(host=server_url)

View File

@@ -1,52 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.default_api import DefaultApi # noqa: E501
class TestDefaultApi(unittest.TestCase):
"""DefaultApi unit test stubs"""
def setUp(self) -> None:
self.api = DefaultApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_get(self) -> None:
"""Test case for get
Get # noqa: E501
"""
pass
def test_health(self) -> None:
"""Test case for health
Health # noqa: E501
"""
pass
def test_root(self) -> None:
"""Test case for root
Root # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -1,94 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.entities_api import EntitiesApi # noqa: E501
class TestEntitiesApi(unittest.TestCase):
"""EntitiesApi unit test stubs"""
def setUp(self) -> None:
self.api = EntitiesApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_attach_entity(self) -> None:
"""Test case for attach_entity
Attach Entity # noqa: E501
"""
pass
def test_create_entity(self) -> None:
"""Test case for create_entity
Create Entity # noqa: E501
"""
pass
def test_delete_entity(self) -> None:
"""Test case for delete_entity
Delete Entity # noqa: E501
"""
pass
def test_detach_entity(self) -> None:
"""Test case for detach_entity
Detach Entity # noqa: E501
"""
pass
def test_get_all_entities(self) -> None:
"""Test case for get_all_entities
Get All Entities # noqa: E501
"""
pass
def test_get_attached_entities(self) -> None:
"""Test case for get_attached_entities
Get Attached Entities # noqa: E501
"""
pass
def test_get_entity_by_did(self) -> None:
"""Test case for get_entity_by_did
Get Entity By Did # noqa: E501
"""
pass
def test_get_entity_by_name(self) -> None:
"""Test case for get_entity_by_name
Get Entity By Name # noqa: E501
"""
pass
def test_is_attached(self) -> None:
"""Test case for is_attached
Is Attached # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -1,65 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.entity import Entity # noqa: E501
class TestEntity(unittest.TestCase):
"""Entity unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Entity:
"""Test Entity
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `Entity`
"""
model = Entity() # noqa: E501
if include_optional:
return Entity(
did = 'did:sov:test:1234',
name = 'C1',
ip = '127.0.0.1',
visible = True,
other = {network=Carlos Home Network, roles=[service repository, service prosumer]},
attached = True,
stop_health_task = True
)
else:
return Entity(
did = 'did:sov:test:1234',
name = 'C1',
ip = '127.0.0.1',
visible = True,
other = {network=Carlos Home Network, roles=[service repository, service prosumer]},
attached = True,
stop_health_task = True,
)
"""
def testEntity(self):
"""Test Entity"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,61 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.entity_create import EntityCreate # noqa: E501
class TestEntityCreate(unittest.TestCase):
"""EntityCreate unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> EntityCreate:
"""Test EntityCreate
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `EntityCreate`
"""
model = EntityCreate() # noqa: E501
if include_optional:
return EntityCreate(
did = 'did:sov:test:1234',
name = 'C1',
ip = '127.0.0.1',
visible = True,
other = {network=Carlos Home Network, roles=[service repository, service prosumer]}
)
else:
return EntityCreate(
did = 'did:sov:test:1234',
name = 'C1',
ip = '127.0.0.1',
visible = True,
other = {network=Carlos Home Network, roles=[service repository, service prosumer]},
)
"""
def testEntityCreate(self):
"""Test EntityCreate"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,59 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.http_validation_error import HTTPValidationError # noqa: E501
class TestHTTPValidationError(unittest.TestCase):
"""HTTPValidationError unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> HTTPValidationError:
"""Test HTTPValidationError
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `HTTPValidationError`
"""
model = HTTPValidationError() # noqa: E501
if include_optional:
return HTTPValidationError(
detail = [
openapi_client.models.validation_error.ValidationError(
loc = [
null
],
msg = '',
type = '', )
]
)
else:
return HTTPValidationError(
)
"""
def testHTTPValidationError(self):
"""Test HTTPValidationError"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,55 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.machine import Machine # noqa: E501
class TestMachine(unittest.TestCase):
"""Machine unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Machine:
"""Test Machine
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `Machine`
"""
model = Machine() # noqa: E501
if include_optional:
return Machine(
name = '',
status = 'online'
)
else:
return Machine(
name = '',
status = 'online',
)
"""
def testMachine(self):
"""Test Machine"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,38 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.repositories_api import RepositoriesApi # noqa: E501
class TestRepositoriesApi(unittest.TestCase):
"""RepositoriesApi unit test stubs"""
def setUp(self) -> None:
self.api = RepositoriesApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_get_all_repositories(self) -> None:
"""Test case for get_all_repositories
Get All Repositories # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -1,63 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.resolution import Resolution # noqa: E501
class TestResolution(unittest.TestCase):
"""Resolution unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Resolution:
"""Test Resolution
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `Resolution`
"""
model = Resolution() # noqa: E501
if include_optional:
return Resolution(
requester_name = 'C1',
requester_did = 'did:sov:test:1122',
resolved_did = 'did:sov:test:1234',
other = {test=test},
timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'),
id = 56
)
else:
return Resolution(
requester_name = 'C1',
requester_did = 'did:sov:test:1122',
resolved_did = 'did:sov:test:1234',
other = {test=test},
timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'),
id = 56,
)
"""
def testResolution(self):
"""Test Resolution"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,38 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.resolution_api import ResolutionApi # noqa: E501
class TestResolutionApi(unittest.TestCase):
"""ResolutionApi unit test stubs"""
def setUp(self) -> None:
self.api = ResolutionApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_get_all_resolutions(self) -> None:
"""Test case for get_all_resolutions
Get All Resolutions # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -1,81 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.service import Service # noqa: E501
class TestService(unittest.TestCase):
"""Service unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Service:
"""Test Service
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `Service`
"""
model = Service() # noqa: E501
if include_optional:
return Service(
uuid = '8e285c0c-4e40-430a-a477-26b3b81e30df',
service_name = 'Carlos Printing',
service_type = '3D Printing',
endpoint_url = 'http://127.0.0.1:8000',
status = 'unknown',
other = {action=[register, deregister, delete, create]},
entity_did = 'did:sov:test:1234',
entity = openapi_client.models.entity.Entity(
did = 'did:sov:test:1234',
name = 'C1',
ip = '127.0.0.1',
visible = True,
other = {network=Carlos Home Network, roles=[service repository, service prosumer]},
attached = True,
stop_health_task = True, )
)
else:
return Service(
uuid = '8e285c0c-4e40-430a-a477-26b3b81e30df',
service_name = 'Carlos Printing',
service_type = '3D Printing',
endpoint_url = 'http://127.0.0.1:8000',
status = 'unknown',
other = {action=[register, deregister, delete, create]},
entity_did = 'did:sov:test:1234',
entity = openapi_client.models.entity.Entity(
did = 'did:sov:test:1234',
name = 'C1',
ip = '127.0.0.1',
visible = True,
other = {network=Carlos Home Network, roles=[service repository, service prosumer]},
attached = True,
stop_health_task = True, ),
)
"""
def testService(self):
"""Test Service"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,65 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.service_create import ServiceCreate # noqa: E501
class TestServiceCreate(unittest.TestCase):
"""ServiceCreate unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> ServiceCreate:
"""Test ServiceCreate
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `ServiceCreate`
"""
model = ServiceCreate() # noqa: E501
if include_optional:
return ServiceCreate(
uuid = '8e285c0c-4e40-430a-a477-26b3b81e30df',
service_name = 'Carlos Printing',
service_type = '3D Printing',
endpoint_url = 'http://127.0.0.1:8000',
status = 'unknown',
other = {action=[register, deregister, delete, create]},
entity_did = 'did:sov:test:1234'
)
else:
return ServiceCreate(
uuid = '8e285c0c-4e40-430a-a477-26b3b81e30df',
service_name = 'Carlos Printing',
service_type = '3D Printing',
endpoint_url = 'http://127.0.0.1:8000',
status = 'unknown',
other = {action=[register, deregister, delete, create]},
entity_did = 'did:sov:test:1234',
)
"""
def testServiceCreate(self):
"""Test ServiceCreate"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,66 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.services_api import ServicesApi # noqa: E501
class TestServicesApi(unittest.TestCase):
"""ServicesApi unit test stubs"""
def setUp(self) -> None:
self.api = ServicesApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_create_service(self) -> None:
"""Test case for create_service
Create Service # noqa: E501
"""
pass
def test_delete_service(self) -> None:
"""Test case for delete_service
Delete Service # noqa: E501
"""
pass
def test_get_all_services(self) -> None:
"""Test case for get_all_services
Get All Services # noqa: E501
"""
pass
def test_get_service_by_did(self) -> None:
"""Test case for get_service_by_did
Get Service By Did # noqa: E501
"""
pass
def test_get_services_without_entity(self) -> None:
"""Test case for get_services_without_entity
Get Services Without Entity # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -1,34 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.status import Status # noqa: E501
class TestStatus(unittest.TestCase):
"""Status unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testStatus(self):
"""Test Status"""
# inst = Status()
if __name__ == '__main__':
unittest.main()

View File

@@ -1,61 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.validation_error import ValidationError # noqa: E501
class TestValidationError(unittest.TestCase):
"""ValidationError unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> ValidationError:
"""Test ValidationError
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `ValidationError`
"""
model = ValidationError() # noqa: E501
if include_optional:
return ValidationError(
loc = [
null
],
msg = '',
type = ''
)
else:
return ValidationError(
loc = [
null
],
msg = '',
type = '',
)
"""
def testValidationError(self):
"""Test ValidationError"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,51 +0,0 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.validation_error_loc_inner import ValidationErrorLocInner # noqa: E501
class TestValidationErrorLocInner(unittest.TestCase):
"""ValidationErrorLocInner unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> ValidationErrorLocInner:
"""Test ValidationErrorLocInner
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `ValidationErrorLocInner`
"""
model = ValidationErrorLocInner() # noqa: E501
if include_optional:
return ValidationErrorLocInner(
)
else:
return ValidationErrorLocInner(
)
"""
def testValidationErrorLocInner(self):
"""Test ValidationErrorLocInner"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()