all: replace `import parent` with an interpreter line hack

We'd like to run our executable python scripts using our new `pywrap`
feature as a better way to get their PYTHONPATH setup properly.  This
script lives in our source tree, at a fixed relative location to each
script that we're interested in, but has no absolute system path.

The #!interpreter syntax does supports relative paths, but they are
resolved relative to the current working directory, not relative to the
file in which they appear, which makes this feature pretty useless.

There are some tricks we can do to get our designed 'relative'
behaviour, though.

Something like this works:

    #!/usr/bin/env -S sh -c '"${0%/*}/pywrap" "$0"'

but it causes various file auto-detection schemes (including our own
test/static-code) to improperly conclude that this is a shell script,
rather than a Python script.  (n)vim also gets it wrong for highlighting
and linting purposes.

Fortunately there's a somewhat longer, but still acceptable version of
this we can do in Python:

    #!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/pywrap", sys.argv)

This fits well under our 118 column limit.

Note that unlike `sh`, the `-c` option in Python doesn't require the
script to be passed as a separate argument, which means we don't need to
use the non-POSIX splitting tricks of `/usr/bin/env -S`.

Note also: it appears as though our hardcoding of /usr/bin/python3 here
might be venv-unfriendly, but it's not: /usr/bin/python3 (which surely
exists) is used only for running this one tiny fragment of code.  Our
pywrap script itself finds python3 in the path.

Let's move all of our previous users of `import parent` over to the new
approach.

We can remove a couple of `parent.py` symlinks we had lying
around, as well.

We also remove `parent.py` itself, since otherwise vulture complains
about it being unused.  Subprojects will be forced to adjust on upgrade.

Remove a CodeQL exemption that was necessitated by our `import parent`
shenanigans.
This commit is contained in:
Allison Karlitskaya 2023-05-26 10:57:53 +02:00
parent d97ddebca2
commit 4a9e30bc86
77 changed files with 85 additions and 183 deletions

View File

@ -1,7 +1,4 @@
query-filters:
- exclude:
# complains about `import parent` in tests; unused imports already handled by flake8
id: py/unused-import
- exclude:
# complains about `...` method bodies and `await`, i.e. mostly false positives
id: py/ineffectual-statement

View File

@ -1,4 +1,4 @@
#! /usr/bin/python
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -32,8 +32,6 @@ import subprocess
import sys
from bisect import bisect_left
import parent # NOQA: imported through a custom PYTHONPATH
from task import github
BASE_DIR = os.path.realpath(f'{__file__}/../../..')

View File

@ -1,18 +0,0 @@
import importlib
import os
import subprocess
import sys
BASE_DIR = os.path.realpath(f'{__file__}/../../..')
TEST_DIR = f'{BASE_DIR}/test'
BOTS_DIR = f'{BASE_DIR}/bots'
sys.path.append(BOTS_DIR)
sys.path.append(f'{TEST_DIR}/common')
sys.path.append(f'{BOTS_DIR}/machine')
def ensure_bots():
if not os.path.isdir(BOTS_DIR):
subprocess.check_call([f'{BASE_DIR}/test/common/make-bots'])
importlib.invalidate_caches()

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3 -B
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/pywrap", sys.argv)
import argparse
import binascii
@ -17,15 +17,11 @@ import time
import unittest
from typing import List, Optional, Tuple
import parent
import testlib
parent.ensure_bots() # OQA: testvm lives in bots/
import testvm
import testlib # noqa: E402, imported through parent.py
import testvm # noqa: E402, imported through parent.py
from lcov import create_coverage_report, prepare_for_code_coverage # NOQA: E402
from lcov import create_coverage_report, prepare_for_code_coverage
os.environ['PYTHONUNBUFFERED'] = '1'

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/common/pywrap", sys.argv)
# Build and run a bots/image-customize command to prepare a VM for testing Cockpit.
# This file is part of Cockpit.
@ -25,13 +25,13 @@ import shutil
import subprocess
import sys
from common.parent import BASE_DIR, BOTS_DIR, TEST_DIR, ensure_bots
from lib import testmap
from lib.constants import DEFAULT_IMAGE
from machine.machine_core import machine_virtual
ensure_bots() # : testvm lives in bots/
from lib import testmap # NOQA: imported through parent.py
from lib.constants import DEFAULT_IMAGE # NOQA: imported through parent.py
from machine.machine_core import machine_virtual # NOQA: imported through parent.py
BASE_DIR = os.path.realpath(f'{__file__}/../..')
TEST_DIR = f'{BASE_DIR}/test'
BOTS_DIR = f'{BASE_DIR}/bots'
def build_rpms(dist_tar, image, verbose, quick):

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from packagelib import PackageCase
from testlib import nondestructive, skipImage, skipOstree, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -25,7 +25,6 @@ import tempfile
import unittest
from glob import glob
import parent # noqa: F401
from testlib import skipDistroPackage, test_main
import testvm

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -22,7 +22,6 @@ import os
import subprocess
import time
import parent # noqa: F401
from testlib import (
TEST_DIR,
MachineCase,

View File

@ -1,4 +1,4 @@
#! /usr/bin/env python3
#! /usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import subprocess
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipBrowser, skipDistroPackage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -22,7 +22,6 @@ import sys
import time
import unittest
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, test_main, todo

View File

@ -1,8 +1,7 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
import os
import parent # noqa: F401
from testlib import TEST_DIR, MachineCase, nondestructive, skipDistroPackage, skipOstree, test_main
EXAMPLES_DIR = os.path.join(os.path.dirname(TEST_DIR), "examples")

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, skipImage, skipOstree, test_main, timeout
from lib.constants import TEST_OS_DEFAULT

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, skipOstree, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# Run this with --help to see available options for tracing and debugging
# See https://github.com/cockpit-project/cockpit/blob/main/test/common/testlib.py
# "class Browser" and "class MachineCase" for the available API.
@ -7,7 +7,6 @@ import re
import time
# import Cockpit's machinery for test VMs and its browser test API
import parent # noqa: F401
import packagelib
from testlib import (
Browser,

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase
from testlib import nondestructive, skipDistroPackage, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase
from testlib import nondestructive, skipDistroPackage, skipImage, skipOstree, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase
from testlib import nondestructive, skipDistroPackage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase, re
from testlib import skipDistroPackage, skipImage, skipOstree, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import time
import parent # noqa: F401
from netlib import NetworkCase
from testlib import Error, nondestructive, skipDistroPackage, skipOstree, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase
from testlib import skipDistroPackage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase
from testlib import skipDistroPackage, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase
from testlib import nondestructive, skipDistroPackage, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase
from testlib import skipDistroPackage, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import json
import parent # noqa: F401
from netlib import NetworkCase
from testlib import nondestructive, skipDistroPackage, skipImage, skipOstree, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase
from testlib import skipDistroPackage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from netlib import NetworkCase
from testlib import nondestructive, skipDistroPackage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -21,7 +21,6 @@ import os
import re
import time
import parent # noqa: F401
from packagelib import PackageCase
from testlib import nondestructive, onlyImage, skipDistroPackage, skipImage, skipOstree, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, test_main
test_manifest = """

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -20,7 +20,6 @@
import os
import time
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, skipOstree, test_main
RHEL_DOC_BASE = "https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_systems_using_the_rhel_8_web_console"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, skipOstree, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import time
import parent # noqa: F401
from testlib import (
Error,
MachineCase,

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import time
import parent # noqa: F401
from testlib import MachineCase, no_retry_when_changed, skipDistroPackage, test_main, todoPybridgeRHEL8

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipBrowser, skipDistroPackage, test_main
FP_SHA256 = "SHA256:iyVAl4Z8riL9Jg4fV9Wv/6cbqebdDtsBEMkojNLLYX8"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import time
import parent # noqa: F401
from testlib import MachineCase, enableAxe, nondestructive, skipDistroPackage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -21,7 +21,6 @@ import re
import subprocess
import time
import parent # noqa: F401
from testlib import MachineCase, skipDistroPackage, skipImage, test_main, todoPybridge, todoPybridgeRHEL8

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -20,7 +20,6 @@
import re
import subprocess
import parent # noqa: F401
from testlib import (
MachineCase,
skipBrowser,

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, skipDistroPackage, test_main, todoPybridgeRHEL8, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -22,7 +22,6 @@ import os.path
import subprocess
import tarfile
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, skipImage, skipOstree, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -22,7 +22,6 @@ import re
import subprocess
import time
import parent # noqa: F401
from testlib import (
MachineCase,
nondestructive,

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import nondestructive, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase, json
from testlib import nondestructive, onlyImage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import nondestructive, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import skipImage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import subprocess
import parent # noqa: F401
from packagelib import PackageCase
from storagelib import StorageCase
from testlib import attach, skipImage, test_main, timeout, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import nondestructive, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
from time import sleep
import parent # noqa: F401
from storagelib import StorageCase
from testlib import Error, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import skipImage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from packagelib import PackageCase
from storagelib import StorageCase, StorageHelpers
from testlib import nondestructive, skipOstree, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import nondestructive, skipMobile, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import unittest
import parent # noqa: F401
from storagelib import StorageCase
from testlib import skipImage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from packagelib import PackageCase
from storagelib import StorageCase
from testlib import skipImage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import nondestructive, onlyImage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from storagelib import StorageCase
from testlib import nondestructive, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import re
import parent # noqa: F401
from packagelib import PackageCase
from storagelib import StorageCase, StorageHelpers
from testlib import onlyImage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import time
import parent # noqa: F401
from testlib import (
MachineCase,
nondestructive,

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -20,7 +20,6 @@
import re
import time
import parent # noqa: F401
from packagelib import PackageCase
from testlib import enableAxe, nondestructive, onlyImage, skipDistroPackage, skipImage, skipOstree, test_main, wait

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import time
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, skipImage, test_main
sleep_crash_list_sel = "#journal-box .cockpit-logline .cockpit-log-message:contains('(sleep) crashed in')"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -24,7 +24,6 @@ import re
import struct
import time
import parent # noqa: F401
import packagelib
from testlib import (
Error,

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -19,7 +19,6 @@
import time
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, test_main, wait
import testvm

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, skipDistroPackage, test_main, todoPybridgeRHEL8

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipBrowser, skipDistroPackage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, skipImage, skipOstree, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -22,7 +22,6 @@ import re
import subprocess
import unittest
import parent # noqa: F401
from testlib import TEST_DIR, MachineCase, no_retry_when_changed, nondestructive, skipDistroPackage, test_main
dirname = os.path.dirname(__file__)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -20,7 +20,6 @@
import datetime
import os
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, skipOstree, test_main, wait
good_password = "tqymuVh.ZfZnP§9Wr=LM3JyG5yx"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, skipDistroPackage, test_main

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,7 +17,6 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
import parent # noqa: F401
from testlib import MachineCase, nondestructive, onlyImage, test_main
HOST = "host.containers.internal"

View File

@ -1 +0,0 @@
../common/parent.py

View File

@ -1 +0,0 @@
../test/common/parent.py

View File

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../test/common/pywrap", sys.argv)
# This file is part of Cockpit.
#
@ -17,10 +17,9 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
# ruff: noqa: I001
import argparse
import fnmatch
import os
import subprocess
import sys
import time
@ -28,9 +27,10 @@ import urllib
import urllib.parse
from urllib.request import Request, urlopen
from parent import BASE_DIR
import task
BASE_DIR = os.path.realpath(f'{__file__}/../..')
DAYS = 7
TASK_NAME = "Validate all URLs"