Skip to content

Commit

Permalink
tests/test_cpiofile.py: Fix test to not be skipped for Python2
Browse files Browse the repository at this point in the history
Signed-off-by: Bernhard Kaindl <[email protected]>
  • Loading branch information
bernhardkaindl committed May 13, 2024
1 parent 039c024 commit 2bd4df3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_cpiofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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]
Expand Down

0 comments on commit 2bd4df3

Please sign in to comment.