- Refresh test_compileall2.py for Python 3.10+ support.
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-compileall2?expand=0&rev=3
This commit is contained in:
parent
ebc601113c
commit
83b2cc6c92
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 28 03:55:46 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Refresh test_compileall2.py for Python 3.10+ support.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 17 08:11:42 AM UTC 2020 - John Vandenberg <jayvdb@gmail.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-compileall2
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -27,11 +27,11 @@ URL: https://github.com/fedora-python/compileall2
|
||||
Source: https://files.pythonhosted.org/packages/source/c/compileall2/compileall2-%{version}.tar.gz
|
||||
Source1: https://raw.githubusercontent.com/fedora-python/compileall2/master/LICENSE
|
||||
Source2: https://raw.githubusercontent.com/fedora-python/compileall2/master/test_compileall2.py
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module testsuite}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
|
@ -30,6 +30,19 @@ except ImportError:
|
||||
# Python 3.4
|
||||
from test import script_helper
|
||||
|
||||
try:
|
||||
# Python < 3.10
|
||||
from test.support import skip_unless_symlink
|
||||
from test.support import unlink
|
||||
from test.support import rmtree
|
||||
from test.support import EnvironmentVarGuard
|
||||
except ImportError:
|
||||
# Python >= 3.10
|
||||
from test.support.os_helper import skip_unless_symlink
|
||||
from test.support.os_helper import unlink
|
||||
from test.support.os_helper import rmtree
|
||||
from test.support.os_helper import EnvironmentVarGuard
|
||||
|
||||
# Backported from subprocess/test.support module for Python <= 3.5
|
||||
def _optim_args_from_interpreter_flags():
|
||||
"""Return a list of command-line arguments reproducing the current
|
||||
@ -64,7 +77,7 @@ def without_source_date_epoch(fxn):
|
||||
"""Runs function with SOURCE_DATE_EPOCH unset."""
|
||||
@functools.wraps(fxn)
|
||||
def wrapper(*args, **kwargs):
|
||||
with support.EnvironmentVarGuard() as env:
|
||||
with EnvironmentVarGuard() as env:
|
||||
env.unset('SOURCE_DATE_EPOCH')
|
||||
return fxn(*args, **kwargs)
|
||||
return wrapper
|
||||
@ -74,7 +87,7 @@ def with_source_date_epoch(fxn):
|
||||
"""Runs function with SOURCE_DATE_EPOCH set."""
|
||||
@functools.wraps(fxn)
|
||||
def wrapper(*args, **kwargs):
|
||||
with support.EnvironmentVarGuard() as env:
|
||||
with EnvironmentVarGuard() as env:
|
||||
env['SOURCE_DATE_EPOCH'] = '123456789'
|
||||
return fxn(*args, **kwargs)
|
||||
return wrapper
|
||||
@ -415,7 +428,7 @@ class CompileallTestsBase:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@support.skip_unless_symlink
|
||||
@skip_unless_symlink
|
||||
def test_ignore_symlink_destination(self):
|
||||
# Create folders for allowed files, symlinks and prohibited area
|
||||
allowed_path = os.path.join(self.directory, "test", "dir", "allowed")
|
||||
@ -745,7 +758,7 @@ class CommandLineTestsBase:
|
||||
sys_path_writable = False
|
||||
break
|
||||
finally:
|
||||
support.unlink(str(path))
|
||||
unlink(str(path))
|
||||
if directory_created:
|
||||
directory.rmdir()
|
||||
else:
|
||||
@ -784,7 +797,7 @@ class CommandLineTestsBase:
|
||||
|
||||
def setUp(self):
|
||||
self.directory = tempfile.mkdtemp()
|
||||
self.addCleanup(support.rmtree, self.directory)
|
||||
self.addCleanup(rmtree, self.directory)
|
||||
self.pkgdir = os.path.join(self.directory, 'foo')
|
||||
os.mkdir(self.pkgdir)
|
||||
self.pkgdir_cachedir = os.path.join(self.pkgdir, '__pycache__')
|
||||
@ -953,7 +966,7 @@ class CommandLineTestsBase:
|
||||
self.assertCompiled(spamfn)
|
||||
self.assertCompiled(eggfn)
|
||||
|
||||
@support.skip_unless_symlink
|
||||
@skip_unless_symlink
|
||||
def test_symlink_loop(self):
|
||||
# Currently, compileall ignores symlinks to directories.
|
||||
# If that limitation is ever lifted, it should protect against
|
||||
@ -1155,7 +1168,7 @@ class CommandLineTestsBase:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@support.skip_unless_symlink
|
||||
@skip_unless_symlink
|
||||
def test_ignore_symlink_destination(self):
|
||||
# Create folders for allowed files, symlinks and prohibited area
|
||||
allowed_path = os.path.join(self.directory, "test", "dir", "allowed")
|
||||
|
Loading…
x
Reference in New Issue
Block a user