From 1b1384faf9fc6917f9229eef0497ea4d52c6b7f4 Mon Sep 17 00:00:00 2001 From: Bernhard Kaindl Date: Mon, 13 May 2024 12:00:00 +0200 Subject: [PATCH] tests/test_cpiofile.py: Fix test to not be skipped for Python2 Signed-off-by: Bernhard Kaindl --- tests/test_cpiofile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_cpiofile.py b/tests/test_cpiofile.py index c948bac4..3f7ea231 100644 --- a/tests/test_cpiofile.py +++ b/tests/test_cpiofile.py @@ -16,7 +16,7 @@ from xcp.cpiofile import CpioFile -from .test_mountingaccessor import binary_data +binary_data = b"\x00\x1b\x5b\x95\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xcc\xdd\xee\xff" def test_cpiofile_modes(fs): @@ -33,7 +33,8 @@ def test_cpiofile_modes(fs): if sys.version_info < (3, 0): # Test Python2 pattern from host-upgrade-plugin:/etc/xapi.d/plugins/prepare_host_upgrade.py # Import the Python2-only StringIO.StringIO module, imported as Py2StringIO: - from StringIO import Py2StringIO # pylint: disable=import-outside-toplevel + # pylint: disable-next=import-outside-toplevel + from StringIO import StringIO as Py2StringIO stringio = Py2StringIO() archive = CpioFile.open(fileobj=stringio, mode="w|gz") # type: ignore[arg-type]