Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename fixture classes that were causing warnings #1822

Merged
merged 3 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ addopts = [
"--numprocesses=auto",
"--strict-markers",
]
filterwarnings = [
"error::pytest.PytestWarning",
]
markers = [
"minio: mark test as requiring minio",
"opensearch: mark test as requiring opensearch",
Expand Down
10 changes: 5 additions & 5 deletions tests/manager/core/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


@dataclass
class TestHttpFixture:
class HttpTestFixture:
server: MockAPIServer
request_with_timeout: Callable[..., requests.Response]

Expand All @@ -21,13 +21,13 @@ def test_http_fixture(mock_web_server: MockAPIServer):
request_with_timeout = functools.partial(
HTTP.request_with_timeout, timeout=1, backoff_factor=0
)
return TestHttpFixture(
return HttpTestFixture(
server=mock_web_server, request_with_timeout=request_with_timeout
)


class TestHTTP:
def test_retries_unspecified(self, test_http_fixture: TestHttpFixture):
def test_retries_unspecified(self, test_http_fixture: HttpTestFixture):
for i in range(1, 7):
response = MockAPIServerResponse()
response.content = b"Ouch."
Expand All @@ -44,7 +44,7 @@ def test_retries_unspecified(self, test_http_fixture: TestHttpFixture):
assert request.path == "/test"
assert request.method == "GET"

def test_retries_none(self, test_http_fixture: TestHttpFixture):
def test_retries_none(self, test_http_fixture: HttpTestFixture):
response = MockAPIServerResponse()
response.content = b"Ouch."
response.status_code = 502
Expand All @@ -60,7 +60,7 @@ def test_retries_none(self, test_http_fixture: TestHttpFixture):
assert request.path == "/test"
assert request.method == "GET"

def test_retries_3(self, test_http_fixture: TestHttpFixture):
def test_retries_3(self, test_http_fixture: HttpTestFixture):
response0 = MockAPIServerResponse()
response0.content = b"Ouch."
response0.status_code = 502
Expand Down
16 changes: 8 additions & 8 deletions tests/manager/sqlalchemy/model/test_licensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def test_unique_uri_constraint(self, db: DatabaseTransactionFixture):
pytest.raises(IntegrityError, db.session.commit)


class TestLicenseFixture:
class LicenseTestFixture:
def __init__(self, db: DatabaseTransactionFixture) -> None:
self.db = db
self.pool = db.licensepool(None)
Expand Down Expand Up @@ -327,12 +327,12 @@ def __init__(self, db: DatabaseTransactionFixture) -> None:


@pytest.fixture(scope="function")
def licenses(db: DatabaseTransactionFixture) -> TestLicenseFixture:
return TestLicenseFixture(db)
def licenses(db: DatabaseTransactionFixture) -> LicenseTestFixture:
return LicenseTestFixture(db)


class TestLicense:
def test_loan_to(self, licenses: TestLicenseFixture):
def test_loan_to(self, licenses: LicenseTestFixture):
# Verify that loaning a license also loans its pool.
pool = licenses.pool
license = licenses.perpetual
Expand Down Expand Up @@ -379,7 +379,7 @@ def test_license_types(
is_inactive,
total_remaining_loans,
currently_available_loans,
licenses: TestLicenseFixture,
licenses: LicenseTestFixture,
):
license = getattr(licenses, license_type)
assert is_perpetual == license.is_perpetual
Expand All @@ -402,7 +402,7 @@ def test_license_types(
],
)
def test_license_checkout(
self, license_type, left, available, licenses: TestLicenseFixture
self, license_type, left, available, licenses: LicenseTestFixture
):
license = getattr(licenses, license_type)
license.checkout()
Expand Down Expand Up @@ -460,14 +460,14 @@ def test_license_checkout(
],
)
def test_license_checkin(
self, license_params, left, available, licenses: TestLicenseFixture
self, license_params, left, available, licenses: LicenseTestFixture
):
l = licenses.db.license(licenses.pool, **license_params)
l.checkin()
assert left == l.checkouts_left
assert available == l.checkouts_available

def test_best_available_license(self, licenses: TestLicenseFixture):
def test_best_available_license(self, licenses: LicenseTestFixture):
next_week = utc_now() + datetime.timedelta(days=7)
time_limited_2 = licenses.db.license(
licenses.pool,
Expand Down