-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Epic: Support for Python 3.8 #55835
Comments
Deprecation Warnings that need to be cleaned up |
I pushed more commits to pull request #56031. Now it fixes all Python 3.8 unit test failures. So after backporting these commits, the Debian package 2019.2.3+dfsg1-2 will build on Ubuntu 20.04 (which contains Python 3.8). |
Related #55900 |
For anyone working on Py3.8 support, some work has been done in https://github.com/saltstack/salt/tree/features/py38-compat?files=1 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Salt fails on Python 3.8: ``` ====================================================================== ERROR: unit.grains.test_core (unittest.loader._FailedTest) ---------------------------------------------------------------------- ImportError: Failed to import test module: unit.grains.test_core Traceback (most recent call last): File "/usr/lib/python3.8/unittest/loader.py", line 436, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name __import__(name) File "tests/unit/grains/test_core.py", line 37, in <module> import salt.grains.core as core File "salt/grains/core.py", line 40, in <module> from platform import _supported_dists ImportError: cannot import name '_supported_dists' from 'platform' (/usr/lib/python3.8/platform.py) ``` So only try to import `_supported_dists` from `platform` for Python <= 3.7. Otherwise rely on the external `distro` module to not need any special handling. Addresses parts of saltstack#55835 Signed-off-by: Benjamin Drung <[email protected]>
This comment has been minimized.
This comment has been minimized.
* Update static requirements to include Py3.8 and Py3.9 (except windows) Windows required package pywin32 doesn't state that it support any python version above Py3.7 * Allow running the test suite against Py3.8 and Py3.9 * Fix deprecation warnings for imports from collections DeprecationWarning: Using or importing the ABCs from `collections` instead of from `collections.abc` is deprecated since Python 3.3, and in 3.9 it will stop working. Therefore try to import the abstract base classes from `collections.abc` before falling back to `collections`. Signed-off-by: Benjamin Drung <[email protected]> * Support distro.linux_distribution Salt fails on Python 3.8: ``` ====================================================================== ERROR: unit.grains.test_core (unittest.loader._FailedTest) ---------------------------------------------------------------------- ImportError: Failed to import test module: unit.grains.test_core Traceback (most recent call last): File "/usr/lib/python3.8/unittest/loader.py", line 436, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name __import__(name) File "tests/unit/grains/test_core.py", line 37, in <module> import salt.grains.core as core File "salt/grains/core.py", line 40, in <module> from platform import _supported_dists ImportError: cannot import name '_supported_dists' from 'platform' (/usr/lib/python3.8/platform.py) ``` So only try to import `_supported_dists` from `platform` for Python <= 3.7. Otherwise rely on the external `distro` module to not need any special handling. Addresses parts of saltstack#55835 Signed-off-by: Benjamin Drung <[email protected]> * Fix RuntimeError: dictionary keys changed during iteration The following unit tests fail on Python 3.8: ``` ====================================================================== ERROR: test_state_config (unit.renderers.test_stateconf.StateConfigRendererTestCase) [CPU:0.0%|MEM:56.6%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/unit/renderers/test_stateconf.py", line 74, in test_state_config result = self._render_sls(''' File "/<<PKGBUILDDIR>>/tests/unit/renderers/test_stateconf.py", line 66, in _render_sls return self._renderers['stateconf']( File "/<<PKGBUILDDIR>>/salt/renderers/stateconf.py", line 227, in render for k in six.iterkeys(tmplctx): # iterate over a copy of keys RuntimeError: dictionary keys changed during iteration ====================================================================== ERROR: test_apply_cloud_providers_config_extend (unit.test_config.ConfigTestCase) [CPU:0.0%|MEM:56.6%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/unit/test_config.py", line 1243, in test_apply_cloud_providers_config_extend salt.config.apply_cloud_providers_config( File "/<<PKGBUILDDIR>>/salt/config/__init__.py", line 3196, in apply_cloud_providers_config for driver, details in six.iteritems(entries): RuntimeError: dictionary keys changed during iteration ====================================================================== ERROR: test_apply_cloud_providers_config_extend_multiple (unit.test_config.ConfigTestCase) [CPU:0.0%|MEM:56.6%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/unit/test_config.py", line 1334, in test_apply_cloud_providers_config_extend_multiple self.assertEqual(ret, salt.config.apply_cloud_providers_config(overrides, defaults=DEFAULT)) File "/<<PKGBUILDDIR>>/salt/config/__init__.py", line 3196, in apply_cloud_providers_config for driver, details in six.iteritems(entries): RuntimeError: dictionary keys changed during iteration ====================================================================== ``` Replace the affected for loop of the first case by a dictionary comprehension to construct the modified dictionary. For the remaining cases, switch from `iteritems` to `iterkeys`, since the dictionary values will be modified. Signed-off-by: Benjamin Drung <[email protected]> * Update PyTestSalt requirement(because we now bundle tornado) * Run the full test suite on Arch under Py3 * Fix deprecation warnings for imports from collections DeprecationWarning: Using or importing the ABCs from `collections` instead of from `collections.abc` is deprecated since Python 3.3, and in 3.9 it will stop working. Therefore try to import the abstract base classes from `collections.abc` before falling back to `collections`. Signed-off-by: Benjamin Drung <[email protected]> * Replace deprecated inspect.formatargspec Python 3.7 raises a deprecation warning: salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly `inspect.formatargspec` is only used in `salt.utils.decorators.signature.identical_signature_wrapper` which is only used in `salt.utils.decorators.path` for decorating the `which` and `which_bin` functions. The function `identical_signature_wrapper` can be simply replaced by Python's `functools.wraps` which is available since at least Python 2.7. When inspecting those wrapped functions, the underlying function (stored in the `__wrapped__` attribute) needs to be inspect instead. fixes saltstack#50911 Signed-off-by: Benjamin Drung <[email protected]> Co-authored-by: Pedro Algarvio <[email protected]> Co-authored-by: Benjamin Drung <[email protected]>
* Update static requirements to include Py3.8 and Py3.9 (except windows) Windows required package pywin32 doesn't state that it support any python version above Py3.7 * Allow running the test suite against Py3.8 and Py3.9 * Fix deprecation warnings for imports from collections DeprecationWarning: Using or importing the ABCs from `collections` instead of from `collections.abc` is deprecated since Python 3.3, and in 3.9 it will stop working. Therefore try to import the abstract base classes from `collections.abc` before falling back to `collections`. Signed-off-by: Benjamin Drung <[email protected]> * Support distro.linux_distribution Salt fails on Python 3.8: ``` ====================================================================== ERROR: unit.grains.test_core (unittest.loader._FailedTest) ---------------------------------------------------------------------- ImportError: Failed to import test module: unit.grains.test_core Traceback (most recent call last): File "/usr/lib/python3.8/unittest/loader.py", line 436, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name __import__(name) File "tests/unit/grains/test_core.py", line 37, in <module> import salt.grains.core as core File "salt/grains/core.py", line 40, in <module> from platform import _supported_dists ImportError: cannot import name '_supported_dists' from 'platform' (/usr/lib/python3.8/platform.py) ``` So only try to import `_supported_dists` from `platform` for Python <= 3.7. Otherwise rely on the external `distro` module to not need any special handling. Addresses parts of saltstack#55835 Signed-off-by: Benjamin Drung <[email protected]> * Fix RuntimeError: dictionary keys changed during iteration The following unit tests fail on Python 3.8: ``` ====================================================================== ERROR: test_state_config (unit.renderers.test_stateconf.StateConfigRendererTestCase) [CPU:0.0%|MEM:56.6%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/unit/renderers/test_stateconf.py", line 74, in test_state_config result = self._render_sls(''' File "/<<PKGBUILDDIR>>/tests/unit/renderers/test_stateconf.py", line 66, in _render_sls return self._renderers['stateconf']( File "/<<PKGBUILDDIR>>/salt/renderers/stateconf.py", line 227, in render for k in six.iterkeys(tmplctx): # iterate over a copy of keys RuntimeError: dictionary keys changed during iteration ====================================================================== ERROR: test_apply_cloud_providers_config_extend (unit.test_config.ConfigTestCase) [CPU:0.0%|MEM:56.6%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/unit/test_config.py", line 1243, in test_apply_cloud_providers_config_extend salt.config.apply_cloud_providers_config( File "/<<PKGBUILDDIR>>/salt/config/__init__.py", line 3196, in apply_cloud_providers_config for driver, details in six.iteritems(entries): RuntimeError: dictionary keys changed during iteration ====================================================================== ERROR: test_apply_cloud_providers_config_extend_multiple (unit.test_config.ConfigTestCase) [CPU:0.0%|MEM:56.6%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/unit/test_config.py", line 1334, in test_apply_cloud_providers_config_extend_multiple self.assertEqual(ret, salt.config.apply_cloud_providers_config(overrides, defaults=DEFAULT)) File "/<<PKGBUILDDIR>>/salt/config/__init__.py", line 3196, in apply_cloud_providers_config for driver, details in six.iteritems(entries): RuntimeError: dictionary keys changed during iteration ====================================================================== ``` Replace the affected for loop of the first case by a dictionary comprehension to construct the modified dictionary. For the remaining cases, switch from `iteritems` to `iterkeys`, since the dictionary values will be modified. Signed-off-by: Benjamin Drung <[email protected]> * Update PyTestSalt requirement(because we now bundle tornado) * Run the full test suite on Arch under Py3 * Fix deprecation warnings for imports from collections DeprecationWarning: Using or importing the ABCs from `collections` instead of from `collections.abc` is deprecated since Python 3.3, and in 3.9 it will stop working. Therefore try to import the abstract base classes from `collections.abc` before falling back to `collections`. Signed-off-by: Benjamin Drung <[email protected]> * Replace deprecated inspect.formatargspec Python 3.7 raises a deprecation warning: salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly `inspect.formatargspec` is only used in `salt.utils.decorators.signature.identical_signature_wrapper` which is only used in `salt.utils.decorators.path` for decorating the `which` and `which_bin` functions. The function `identical_signature_wrapper` can be simply replaced by Python's `functools.wraps` which is available since at least Python 2.7. When inspecting those wrapped functions, the underlying function (stored in the `__wrapped__` attribute) needs to be inspect instead. fixes saltstack#50911 Signed-off-by: Benjamin Drung <[email protected]> Co-authored-by: Pedro Algarvio <[email protected]> Co-authored-by: Benjamin Drung <[email protected]>
* Update static requirements to include Py3.8 and Py3.9 (except windows) Windows required package pywin32 doesn't state that it support any python version above Py3.7 * Allow running the test suite against Py3.8 and Py3.9 * Fix deprecation warnings for imports from collections DeprecationWarning: Using or importing the ABCs from `collections` instead of from `collections.abc` is deprecated since Python 3.3, and in 3.9 it will stop working. Therefore try to import the abstract base classes from `collections.abc` before falling back to `collections`. Signed-off-by: Benjamin Drung <[email protected]> * Support distro.linux_distribution Salt fails on Python 3.8: ``` ====================================================================== ERROR: unit.grains.test_core (unittest.loader._FailedTest) ---------------------------------------------------------------------- ImportError: Failed to import test module: unit.grains.test_core Traceback (most recent call last): File "/usr/lib/python3.8/unittest/loader.py", line 436, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name __import__(name) File "tests/unit/grains/test_core.py", line 37, in <module> import salt.grains.core as core File "salt/grains/core.py", line 40, in <module> from platform import _supported_dists ImportError: cannot import name '_supported_dists' from 'platform' (/usr/lib/python3.8/platform.py) ``` So only try to import `_supported_dists` from `platform` for Python <= 3.7. Otherwise rely on the external `distro` module to not need any special handling. Addresses parts of saltstack#55835 Signed-off-by: Benjamin Drung <[email protected]> * Fix RuntimeError: dictionary keys changed during iteration The following unit tests fail on Python 3.8: ``` ====================================================================== ERROR: test_state_config (unit.renderers.test_stateconf.StateConfigRendererTestCase) [CPU:0.0%|MEM:56.6%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/unit/renderers/test_stateconf.py", line 74, in test_state_config result = self._render_sls(''' File "/<<PKGBUILDDIR>>/tests/unit/renderers/test_stateconf.py", line 66, in _render_sls return self._renderers['stateconf']( File "/<<PKGBUILDDIR>>/salt/renderers/stateconf.py", line 227, in render for k in six.iterkeys(tmplctx): # iterate over a copy of keys RuntimeError: dictionary keys changed during iteration ====================================================================== ERROR: test_apply_cloud_providers_config_extend (unit.test_config.ConfigTestCase) [CPU:0.0%|MEM:56.6%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/unit/test_config.py", line 1243, in test_apply_cloud_providers_config_extend salt.config.apply_cloud_providers_config( File "/<<PKGBUILDDIR>>/salt/config/__init__.py", line 3196, in apply_cloud_providers_config for driver, details in six.iteritems(entries): RuntimeError: dictionary keys changed during iteration ====================================================================== ERROR: test_apply_cloud_providers_config_extend_multiple (unit.test_config.ConfigTestCase) [CPU:0.0%|MEM:56.6%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/<<PKGBUILDDIR>>/tests/unit/test_config.py", line 1334, in test_apply_cloud_providers_config_extend_multiple self.assertEqual(ret, salt.config.apply_cloud_providers_config(overrides, defaults=DEFAULT)) File "/<<PKGBUILDDIR>>/salt/config/__init__.py", line 3196, in apply_cloud_providers_config for driver, details in six.iteritems(entries): RuntimeError: dictionary keys changed during iteration ====================================================================== ``` Replace the affected for loop of the first case by a dictionary comprehension to construct the modified dictionary. For the remaining cases, switch from `iteritems` to `iterkeys`, since the dictionary values will be modified. Signed-off-by: Benjamin Drung <[email protected]> * Update PyTestSalt requirement(because we now bundle tornado) * Run the full test suite on Arch under Py3 * Fix deprecation warnings for imports from collections DeprecationWarning: Using or importing the ABCs from `collections` instead of from `collections.abc` is deprecated since Python 3.3, and in 3.9 it will stop working. Therefore try to import the abstract base classes from `collections.abc` before falling back to `collections`. Signed-off-by: Benjamin Drung <[email protected]> * Replace deprecated inspect.formatargspec Python 3.7 raises a deprecation warning: salt/utils/decorators/signature.py:31: DeprecationWarning: `formatargspec` is deprecated since Python 3.5. Use `signature` and the `Signature` object directly `inspect.formatargspec` is only used in `salt.utils.decorators.signature.identical_signature_wrapper` which is only used in `salt.utils.decorators.path` for decorating the `which` and `which_bin` functions. The function `identical_signature_wrapper` can be simply replaced by Python's `functools.wraps` which is available since at least Python 2.7. When inspecting those wrapped functions, the underlying function (stored in the `__wrapped__` attribute) needs to be inspect instead. fixes saltstack#50911 Signed-off-by: Benjamin Drung <[email protected]> Co-authored-by: Pedro Algarvio <[email protected]> Co-authored-by: Benjamin Drung <[email protected]>
Salt fails on Python 3.8: ``` ====================================================================== ERROR: unit.grains.test_core (unittest.loader._FailedTest) ---------------------------------------------------------------------- ImportError: Failed to import test module: unit.grains.test_core Traceback (most recent call last): File "/usr/lib/python3.8/unittest/loader.py", line 436, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.8/unittest/loader.py", line 377, in _get_module_from_name __import__(name) File "tests/unit/grains/test_core.py", line 37, in <module> import salt.grains.core as core File "salt/grains/core.py", line 40, in <module> from platform import _supported_dists ImportError: cannot import name '_supported_dists' from 'platform' (/usr/lib/python3.8/platform.py) ``` So only try to import `_supported_dists` from `platform` for Python <= 3.7. Otherwise rely on the external `distro` module to not need any special handling. Addresses parts of saltstack#55835 Signed-off-by: Benjamin Drung <[email protected]>
Description of Issue
Epic or bucket ticket for tasks for supporting Python 3.8 changes going forward, as an epic this ticket may span more than one release over time.
Related ticket(s):
The text was updated successfully, but these errors were encountered: