Skip to content

Commit

Permalink
Run generated upgrade_through_versions_test on pytest >7.2.0
Browse files Browse the repository at this point in the history
pytest-7.2.0 changed how markers were inherited, pytest-dev/pytest#7792

 patch by Mick Semb Wever; reviewed by XXX for CASSANDRA-18499
  • Loading branch information
michaelsembwever committed Jul 16, 2023
1 parent 1ce3420 commit d4fcdd6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions conftest.py
Expand Up @@ -113,8 +113,8 @@ def pytest_configure(config):
def sufficient_system_resources_for_resource_intensive_tests():
mem = virtual_memory()
total_mem_gb = mem.total / 1024 / 1024 / 1024
logger.info("total available system memory is %dGB" % total_mem_gb)
# todo kjkj: do not hard code our bound.. for now just do 9 instances at 3gb a piece
logger.info("total available system memory is %dGB, require 27GB for resource intensive tests" % total_mem_gb)
# do not hard code our bound.. for now just do 9 instances at 3gb a piece
return total_mem_gb >= 9 * 3


Expand Down
14 changes: 8 additions & 6 deletions upgrade_tests/upgrade_through_versions_test.py
Expand Up @@ -22,8 +22,8 @@
from tools.misc import generate_ssl_stores, new_node
from .upgrade_manifest import (build_upgrade_pairs,
current_2_2_x,
current_3_0_x, indev_3_11_x, current_3_11_x,
current_4_0_x, indev_4_1_x, current_4_1_x,
current_3_0_x, current_3_11_x,
current_4_0_x, current_4_1_x,
indev_trunk,
CASSANDRA_4_0, CASSANDRA_5_0,
RUN_STATIC_UPGRADE_MATRIX)
Expand Down Expand Up @@ -297,7 +297,7 @@ def shutdown_gently():

@pytest.mark.upgrade_test
@pytest.mark.resource_intensive
@pytest.mark.skip("Fake skip so that this isn't run outside of a generated class that removes this annotation")
@pytest.mark.skip(reason="Skip base class, only generated classes run the tests")
class TestUpgrade(Tester):
"""
Upgrades a 3-node Murmur3Partitioner cluster through versions specified in test_version_metas.
Expand Down Expand Up @@ -886,9 +886,11 @@ def create_upgrade_class(clsname, version_metas, protocol_version,
# Remove the skip annotation in the superclass we just derived from, we will add it back if we actually intend
# to skip with a better message
newcls.pytestmark = [mark for mark in newcls.pytestmark if not mark.name == "skip"]
#if not upgrade_applies_to_env:
#print("boo")
#newcls.pytestmark.append(pytest.mark.skip("test not applicable to env"))
# Remove the skip annotation from the parent_class too, it has already effectively been skipped
TestUpgrade.pytestmark = [mark for mark in TestUpgrade.pytestmark if not mark.name == "skip"]
if not upgrade_applies_to_env:
print("re-adding skip annotation to {} ".format(clsname))
newcls.pytestmark.append(pytest.mark.skip("test not applicable to env"))
print(newcls.pytestmark)

if clsname in globals():
Expand Down

0 comments on commit d4fcdd6

Please sign in to comment.