ruff: remove custom isort config for test/common

Without the parent hacks we can just treat the bots and testlib stuff as
normal third party imports.

This causes one small problem: ruff defaults to auto-detect files in the
current directory as first-party imports, which affects a couple of
imports in test/common/run-tests.  Those are only detected first-party
if the files are present when we run ruff, which is not the case for
incremental changes checked by test/static-code when used as part of a
git hook.  This wasn't a problem before, because we hardcoded the
modules.  Disable ruff's automatic import checking (at the problem
toplevel) to avoid that problem in this case and potential future cases.
This commit is contained in:
Allison Karlitskaya 2023-05-26 11:18:34 +02:00
parent 4a9e30bc86
commit 246668d75c
14 changed files with 13 additions and 50 deletions

View File

@ -58,6 +58,7 @@ ignore = [
"PT011", # `pytest.raises(OSError)` is too broad
]
line-length = 118
src = []
[tool.ruff.flake8-pytest-style]
fixture-parentheses = false

View File

@ -13,27 +13,3 @@ ignore = [
"FBT003", # Boolean positional value in function call
"PT009", # Use a regular `assert` instead of unittest-style `assertEqual`
]
[isort]
section-order = [
"future", "standard-library", "third-party",
"test-common", "bots",
"first-party", "local-folder"
]
force-to-top = ["parent"]
[isort.sections]
"bots" = [
"lib",
"machine_core",
"task",
"testvm",
]
"test-common" = [
"cdp",
"parent",
"netlib",
"packagelib",
"storagelib",
"testlib",
]

View File

@ -18,9 +18,7 @@ import unittest
from typing import List, Optional, Tuple
import testlib
import testvm
from lcov import create_coverage_report, prepare_for_code_coverage
os.environ['PYTHONUNBUFFERED'] = '1'

View File

@ -41,11 +41,9 @@ from time import sleep
from typing import Any, Callable, Dict, List, Optional, Union
import cdp
import testvm
from lib.constants import OSTREE_IMAGES
from lcov import write_lcov
from lib.constants import OSTREE_IMAGES
try:
from PIL import Image

View File

@ -25,9 +25,8 @@ import tempfile
import unittest
from glob import glob
from testlib import skipDistroPackage, test_main
import testvm
from testlib import skipDistroPackage, test_main
@unittest.skipUnless("TEST_OS" in os.environ, "TEST_OS not set")

View File

@ -17,9 +17,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
from testlib import MachineCase, nondestructive, skipDistroPackage, skipImage, skipOstree, test_main, timeout
from lib.constants import TEST_OS_DEFAULT
from testlib import MachineCase, nondestructive, skipDistroPackage, skipImage, skipOstree, test_main, timeout
class KdumpHelpers(MachineCase):

View File

@ -8,6 +8,8 @@ import time
# import Cockpit's machinery for test VMs and its browser test API
import packagelib
from lib.constants import TEST_OS_DEFAULT
from machine_core import ssh_connection
from testlib import (
Browser,
Error,
@ -21,9 +23,6 @@ from testlib import (
wait,
)
from lib.constants import TEST_OS_DEFAULT
from machine_core import ssh_connection
def getMaximumSpike(test, g_type, saturation, hour, minute):
# only for minutes with events, which have SVG graphs

View File

@ -17,11 +17,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
from lib.constants import TEST_OS_DEFAULT
from netlib import NetworkCase
from testlib import nondestructive, skipDistroPackage, skipImage, skipOstree, test_main, wait
from lib.constants import TEST_OS_DEFAULT
@nondestructive
@skipDistroPackage()

View File

@ -17,11 +17,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
from lib.constants import TEST_OS_DEFAULT
from netlib import NetworkCase
from testlib import skipDistroPackage, test_main
from lib.constants import TEST_OS_DEFAULT
@skipDistroPackage()
class TestNetworkingMAC(NetworkCase):

View File

@ -17,11 +17,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
from lib.constants import TEST_OS_DEFAULT
from netlib import NetworkCase
from testlib import skipDistroPackage, test_main, wait
from lib.constants import TEST_OS_DEFAULT
@skipDistroPackage()
class TestNetworkingMTU(NetworkCase):

View File

@ -17,11 +17,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
from lib.constants import TEST_OS_DEFAULT
from netlib import NetworkCase
from testlib import skipDistroPackage, test_main, wait
from lib.constants import TEST_OS_DEFAULT
@skipDistroPackage()
class TestNetworkingSettings(NetworkCase):

View File

@ -17,11 +17,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
from lib.constants import TEST_OS_DEFAULT
from netlib import NetworkCase
from testlib import skipDistroPackage, test_main
from lib.constants import TEST_OS_DEFAULT
@skipDistroPackage()
class TestNetworkingUnmanaged(NetworkCase):

View File

@ -19,6 +19,7 @@
import time
from lib.constants import TEST_OS_DEFAULT
from testlib import (
Error,
MachineCase,
@ -30,8 +31,6 @@ from testlib import (
test_main,
)
from lib.constants import TEST_OS_DEFAULT
FIX_AUDITD = """
set -e
mkdir -p /var/log/audit

View File

@ -19,9 +19,8 @@
import time
from testlib import MachineCase, nondestructive, skipDistroPackage, test_main, wait
import testvm
from testlib import MachineCase, nondestructive, skipDistroPackage, test_main, wait
@nondestructive