Skip to content

Commit

Permalink
skip lower python versions
Browse files Browse the repository at this point in the history
Signed-off-by: Plamen Dimitrov <[email protected]>
  • Loading branch information
pevogam committed Mar 23, 2023
1 parent da4d634 commit 018966f
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions selftests/functional/plugin/spawners/test_lxc.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import asyncio
import os
import sys
from unittest import mock

from avocado import Test
from avocado import Test, skipIf
from avocado.core.job import Job
from avocado.plugins.spawners import lxc
from avocado.plugins.spawners.lxc import LXCSpawner
Expand All @@ -28,12 +29,10 @@ def setUp(self):
self.spawner = LXCSpawner(config, job)
LXCSpawner.slots_cache = {}

@skipIf(sys.version_info > (3, 7, 0), "Not compatible with Python under 3.7.0")
def test_slots_cache_custom(self):
"""Checks if custom (scheduler predefined) slots could be used from cache."""
runtime_task = mock.MagicMock()
# TODO: this is only for compatibility with older python version so
# drop it once we move forward and support only newer mock file features
runtime_task.task.identifier.str_filesystem = "task1"
runtime_task.spawner_handle = "c100"

to_spawn = self.spawner.spawn_task(runtime_task)
Expand All @@ -51,12 +50,10 @@ def test_slots_cache_custom(self):
{"c1": False, "c2": False, "c3": False, "c100": False},
)

@skipIf(sys.version_info > (3, 7, 0), "Not compatible with Python under 3.7.0")
def test_slots_cache_free(self):
"""Checks if free slots could be used from cache."""
runtime_task = mock.MagicMock()
# TODO: this is only for compatibility with older python version so
# drop it once we move forward and support only newer mock file features
runtime_task.task.identifier.str_filesystem = "task1"
runtime_task.spawner_handle = None

to_spawn = self.spawner.spawn_task(runtime_task)
Expand All @@ -73,12 +70,10 @@ def test_slots_cache_free(self):
LXCSpawner.slots_cache, {"c1": False, "c2": False, "c3": False}
)

@skipIf(sys.version_info > (3, 7, 0), "Not compatible with Python under 3.7.0")
def test_slots_cache_free_next(self):
"""Checks if free slots could be used from cache with some slots occupied."""
runtime_task = mock.MagicMock()
# TODO: this is only for compatibility with older python version so
# drop it once we move forward and support only newer mock file features
runtime_task.task.identifier.str_filesystem = "task1"
runtime_task.spawner_handle = None
LXCSpawner.slots_cache = {"c1": True, "c2": False}

Expand All @@ -95,12 +90,10 @@ def test_slots_cache_free_next(self):
# c1 remains occupied throughout this test run
self.assertEqual(LXCSpawner.slots_cache, {"c1": True, "c2": False})

@skipIf(sys.version_info > (3, 7, 0), "Not compatible with Python under 3.7.0")
def test_slots_cache_full(self):
"""Checks if free slots could be used from cache with some slots occupied."""
runtime_task = mock.MagicMock()
# TODO: this is only for compatibility with older python version so
# drop it once we move forward and support only newer mock file features
runtime_task.task.identifier.str_filesystem = "task1"
runtime_task.spawner_handle = None
LXCSpawner.slots_cache = {"c1": True}

Expand All @@ -117,12 +110,10 @@ def test_slots_cache_full(self):
LXC_BACKEND.Container.assert_not_called()
self.assertEqual(LXCSpawner.slots_cache, {"c1": True})

@skipIf(sys.version_info > (3, 7, 0), "Not compatible with Python under 3.7.0")
def test_slots_cache_empty(self):
"""Checks if no slots could be used from cache with expected errors."""
runtime_task = mock.MagicMock()
# TODO: this is only for compatibility with older python version so
# drop it once we move forward and support only newer mock file features
runtime_task.task.identifier.str_filesystem = "task1"
runtime_task.spawner_handle = None
self.spawner.config["spawner.lxc.slots"] = ""

Expand Down

0 comments on commit 018966f

Please sign in to comment.