Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Replace parent class BaseAPITestCase by unittest.TestCase #77

Closed
rochacbruno opened this issue Sep 11, 2018 · 4 comments
Closed

Replace parent class BaseAPITestCase by unittest.TestCase #77

rochacbruno opened this issue Sep 11, 2018 · 4 comments
Labels
Issue Type: Plan Improvements to be added to the code basis

Comments

@rochacbruno
Copy link
Member

Migrated from pulp/pulp-smash#763
author: @kersommoura - https://github.com/kersommoura
date created: 2017-08-22T18:57:32Z

Few tests fail due to time-out that happening during the execution of tear down.
To reduce the number of calls to client.delete(ORPHANS_PATH), and try to reduce the number of failures. Replace the BaseAPITestCase by unittest.TestCase.

    @classmethod
    def tearDownClass(cls):
        """Delete all resources named by ``resources``."""
        client = api.Client(cls.cfg)
        for resource in cls.resources:
            client.delete(resource)
        client.delete(ORPHANS_PATH)

Basically, it will be necessary pass class by class, replace the parent class and do the necessary re-factors.

See also: #762

@rochacbruno rochacbruno added Issue Type: Plan Improvements to be added to the code basis pulp2test labels Sep 11, 2018
@rochacbruno
Copy link
Member Author

Migrated from pulp/pulp-smash#763 (comment)
author: @Ichimonji10 - https://github.com/Ichimonji10
date created: 2018-05-25T17:50:51Z

pulp/pulp-smash#1025 deprecated BaseAPITestCase.

@bherrin3 bherrin3 self-assigned this Oct 30, 2018
bherrin3 pushed a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 3, 2018
	- Updated InstallDistributorThrowsOnErrorTestCase
bherrin3 pushed a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 3, 2018
	- Updated InstallDistributorThrowsOnErrorTestCase
	- Updated InstallDistributorTestCase
bherrin3 pushed a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 5, 2018
	- Updated InstallDistributorThrowsOnErrorTestCase
	- Updated InstallDistributorTestCase
	- Updated DuplicateUploadsTestCase
bherrin3 pushed a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 5, 2018
	Refactor Locations Completed:
	- tests/puppet/api_v2
bherrin3 pushed a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 5, 2018
	Refactor Locations Completed:
	- tests/puppet/api_v2
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 5, 2018
	Refactor Locations Completed:
	- tests/puppet/api_v2
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 5, 2018
	Refactor Locations Completed:
	- tests/puppet/api_v2
@nixocio nixocio removed the pulp2test label Nov 7, 2018
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 7, 2018
Addresses some BaseAPITestCase refactoring.

Refactor Locations updated:
	- tests/puppet/api_v2
nixocio pushed a commit that referenced this issue Nov 8, 2018
Addresses some BaseAPITestCase refactoring.

Refactor Locations updated:
	- tests/puppet/api_v2
bherrin3 pushed a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 8, 2018
Ref pulp#77 for refactor of tests using BaseAPITestCase
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 9, 2018
Refactor of BaseAPITestCase usage for unittest
See: pulp#77
Ref pulp#77
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 9, 2018
Refactor of BaseAPITestCase usage for unittest
See: pulp#77
Ref pulp#77
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 9, 2018
Refactor of BaseAPITestCase usage for unittest
See: pulp#77
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 9, 2018
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 9, 2018
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 9, 2018
Refactor of BaseAPITestCase usage for unittest
See: pulp#77
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 9, 2018
Replacing and refactoring SelectiveAssociateTestCase method from removal
of BaseCaseAPITest with unittest

See: pulp#77
nixocio pushed a commit that referenced this issue Nov 9, 2018
Replacing and refactoring SelectiveAssociateTestCase method from removal
of BaseCaseAPITest with unittest

See: #77
bherrin3 pushed a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 12, 2018
Replacing and refactoring UploadDrpmTestCase method from removal
of BaseCaseAPITest with unittest

See: pulp#77
bherrin3 pushed a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 12, 2018
… issue 77

Replacing and refactoring UploadDrpmTestCaseWithCheckSumType method from removal
of BaseCaseAPITest with unittest

See: pulp#77
nixocio pushed a commit that referenced this issue Nov 12, 2018
… issue 77

Replacing and refactoring UploadDrpmTestCaseWithCheckSumType method from removal
of BaseCaseAPITest with unittest

See: #77
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 13, 2018
Replacing and refactoring UploadDrpmTestCaseWithCheckSumType method from removal
of BaseCaseAPITest with unittest.

See: pulp#77
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 13, 2018
Replacing and refactoring UpdateRepoTestCase method by from removal
of BaseCaseAPITest with unittest.

See: pulp#77
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 13, 2018
Completes the refactor of test_sync_publish from BaseAPTITest to
unittest.

See: pulp#77
nixocio pushed a commit that referenced this issue Nov 16, 2018
Completes the refactor of test_sync_publish from BaseAPTITest to
unittest.

See: #77
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 19, 2018
Replacing and refactoring UploadDrpmTestCaseWithCheckSumType method from removal
of BaseCaseAPITest with unittest.

See: pulp#77
rochacbruno pushed a commit that referenced this issue Nov 20, 2018
Replacing and refactoring UploadDrpmTestCaseWithCheckSumType method from removal
of BaseCaseAPITest with unittest.

See: #77
bherrin3 added a commit to bherrin3/Pulp-2-Tests that referenced this issue Nov 27, 2018
Replacing and refactoring UpdateRepoTestCase method by from removal
of BaseCaseAPITest with unittest.

See: pulp#77
nixocio pushed a commit that referenced this issue Nov 27, 2018
Replacing and refactoring UpdateRepoTestCase method by from removal
of BaseCaseAPITest with unittest.

See: #77
@bherrin3 bherrin3 removed their assignment Oct 2, 2019
@nixocio
Copy link
Contributor

nixocio commented Oct 2, 2019

Replacing the use of base classes it will allow the usage of newer versions of pytest.

See: pulp/pulp-ci@d5f3f2f

@rochacbruno
Copy link
Member Author

conftest.py

def pytest_collection_modifyitems(items, config):
    deselected = []
    for item in items:
        if item.function.__name__ == 'BaseAPIClass':
            deselected.append(item)
    config.hook.pytest_deselected(items=deselected)
    items[:] = [item for item in items if item not in deselected]
        

@nixocio
Copy link
Contributor

nixocio commented Oct 10, 2019

Those are the tests currently failing when running using pytest 5.2.1.

    ostree.api_v2.test_crud.BaseAPICrudTestCase.test_create
    ostree.api_v2.test_crud.BaseAPICrudTestCase.test_importer_config
    ostree.api_v2.test_crud.BaseAPICrudTestCase.test_importer_type_id
    ostree.api_v2.test_crud.BaseAPICrudTestCase.test_number_importers
    ostree.api_v2.test_crud.BaseAPICrudTestCase.test_read
    ostree.api_v2.test_crud.BaseAPICrudTestCase.test_status_codes
    ostree.api_v2.test_crud.BaseAPICrudTestCase.test_update
    puppet.api_v2.test_crud.BaseAPICrudTestCase.test_create
    puppet.api_v2.test_crud.BaseAPICrudTestCase.test_importer_config
    puppet.api_v2.test_crud.BaseAPICrudTestCase.test_importer_type_id
    puppet.api_v2.test_crud.BaseAPICrudTestCase.test_number_importers
    puppet.api_v2.test_crud.BaseAPICrudTestCase.test_read
    puppet.api_v2.test_crud.BaseAPICrudTestCase.test_status_codes
    puppet.api_v2.test_crud.BaseAPICrudTestCase.test_update
    python.api_v2.test_crud.BaseAPICrudTestCase.test_create
    python.api_v2.test_crud.BaseAPICrudTestCase.test_importer_config
    python.api_v2.test_crud.BaseAPICrudTestCase.test_importer_type_id
    python.api_v2.test_crud.BaseAPICrudTestCase.test_number_importers
    python.api_v2.test_crud.BaseAPICrudTestCase.test_read
    python.api_v2.test_crud.BaseAPICrudTestCase.test_status_codes
    python.api_v2.test_crud.BaseAPICrudTestCase.test_update
    rpm.api_v2.test_crud.BaseAPICrudTestCase.test_create
    rpm.api_v2.test_crud.BaseAPICrudTestCase.test_importer_config
    rpm.api_v2.test_crud.BaseAPICrudTestCase.test_importer_type_id
    rpm.api_v2.test_crud.BaseAPICrudTestCase.test_number_importers
    rpm.api_v2.test_crud.BaseAPICrudTestCase.test_read
    rpm.api_v2.test_crud.BaseAPICrudTestCase.test_status_codes
    rpm.api_v2.test_crud.BaseAPICrudTestCase.test_update

nixocio pushed a commit to nixocio/Pulp-2-Tests that referenced this issue Oct 10, 2019
Add conftest.py to deselect base class BaseAPICrudTestCase to be detect
as a test to run.

See: pulp#77
nixocio pushed a commit to nixocio/Pulp-2-Tests that referenced this issue Oct 10, 2019
Add conftest.py to deselect base class BaseAPICrudTestCase to be detect
as a test to run.

See: pulp#77
bherrin3 pushed a commit that referenced this issue Oct 10, 2019
Add conftest.py to deselect base class BaseAPICrudTestCase to be detect
as a test to run.

See: #77
@ipanova ipanova closed this as completed Dec 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Issue Type: Plan Improvements to be added to the code basis
Projects
None yet
Development

No branches or pull requests

4 participants