Skip to content

Remove old python2-related code and add python 3.11 support #715

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

Merged
merged 2 commits into from
Nov 28, 2022

Conversation

delatrie
Copy link
Contributor

@delatrie delatrie commented Nov 28, 2022

Since we decided to support only py3.7+ (and possibly 3.6) this PR aims to clean the code base from python2 old-style and compatibility constructs, including:

  • old-style unicode literals (u'', u"")
  • encoding declarations (comments # -*- coding: UTF-8 -*- at the top of a file)
  • explicit class inheritance from object
  • inheritance of the features already included in python 3.6+: unicode_literals, absolute_import, division, print_function (i.e. constructs in form from __future__ import "<feature>")
  • allure_commons._compat.format_exception_only function and allure_commons._compat module altogether (traceback.format_exception_only is used instead)
  • six compatability library:
    • Branches depending on six.PY2 was removed
    • six.with_metaclass replaced with metaclass= in object class declarations
    • six.text_type is always str in py3
    • six.string_types is always str in py3
  • enum32 dependency of allure-python-commons: backport of enums for py3.4
  • py2-related unicode-encoded json file writing algorithm in allure_commons.logger.AllureFileLogger._report_item
  • allure_commons.utils.escape_non_unicode_symbols function (returns an argument itself in python3)
  • allure_commons.getargspec function (inspect.getfullargspec is used in py3 instead)

Also made some refactorings and small changes:

  • Replace %-formatting and str.format with string interpolation (f-strings) where is improves readability
  • Add supported python version classifiers in setup.py files
  • Update python version to 3.11 in linting step of the build workflow
  • Add py3.11 to build&test matrix of the build workflow
  • Update checkout to v3 and setup-python to v4 in the release workflow
  • Factor out link formatting in allure_pytest.helper.AllureTestHelper.decorate_as_link and allure_pytest.listener.AllureListener.add_link to allure_pytest.utils.format_allure_link (following DRY)
  • Fix allure_test/test/acceptance/fixture/yield_fixture_test.py::test_yield_fixture test to actually check a yield-fixture (not a usual one) - Fixes Allure-pytest: Yield_fixture test is invalid #551
  • Refactor a link creation in allure_robotframework.listener.utils, make parse_link a module-level function (it has no dependencies on local variables)
  • Remove dependency on dict keys ordering in py3.6 since it's an implementation detail of the CPython 3.6. Insertion order preservation became a part of the spec in py3.7. See here and here.

@delatrie delatrie changed the title Remove old python2-related code Remove old python2-related code and add python 3.11 support Nov 28, 2022
@delatrie delatrie requested a review from skhomuti November 28, 2022 09:42
@skhomuti skhomuti merged commit bbe1ee9 into master Nov 28, 2022
@skhomuti skhomuti deleted the update-python-versoins branch November 28, 2022 10:57
beckerGil pushed a commit to beckerGil/allure-python that referenced this pull request Apr 10, 2023
beckerGil pushed a commit to beckerGil/allure-python that referenced this pull request Apr 10, 2023
IvanBuruyane pushed a commit to IvanBuruyane/allure-python that referenced this pull request Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allure-pytest: Yield_fixture test is invalid
3 participants