From 98e4dbdd7fad5da508279efdb02d96a8ba8b1eff Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Mon, 8 Jun 2020 12:55:23 -0400 Subject: [PATCH 1/3] Add Python 3.8 support More info: - https://docs.python.org/3.8/whatsnew/3.8.html --- README.rst | 4 ++-- setup.py | 3 ++- tox.ini | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 550c7bb4..73f69745 100644 --- a/README.rst +++ b/README.rst @@ -43,8 +43,8 @@ Status Supported Python versions ------------------------- -Only Python 3.7. Python 3.6 and below will not work because we use some features introduced in -Python 3.7. +Only Python 3.7 and 3.8. Python 3.6 and below will not work because we use some features introduced +in Python 3.7. Quickstart ---------- diff --git a/setup.py b/setup.py index d9707283..f5094afb 100755 --- a/setup.py +++ b/setup.py @@ -75,6 +75,7 @@ def get_version(*file_paths: Sequence[str]) -> str: 'Natural Language :: English', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', ], description="""Python library for Servicio de Impuestos Internos (SII) of Chile.""", extras_require=extras_requirements, @@ -86,7 +87,7 @@ def get_version(*file_paths: Sequence[str]) -> str: name='cl-sii', package_data=_package_data, packages=find_packages(exclude=['docs', 'tests*']), - python_requires='>=3.7, <3.8', + python_requires='>=3.7, <3.9', setup_requires=setup_requirements, test_suite='tests', tests_require=test_requirements, diff --git a/tox.ini b/tox.ini index e2329362..27abbb3a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,7 @@ [tox] envlist = - py37 + py37, + py38, [testenv] setenv = @@ -10,3 +11,4 @@ deps = -r{toxinidir}/requirements/test.txt basepython = py37: python3.7 + py38: python3.8 From 0b981e5cbfc547ba614207a07f592727f8514ad9 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Mon, 8 Jun 2020 12:59:51 -0400 Subject: [PATCH 2/3] config: Add support for multiple Python versions to CircleCI --- .circleci/config.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index de5284db..b2036456 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -9,11 +9,16 @@ # - https://circleci.com/docs/2.0/language-python/ for more details # - https://circleci.com/docs/2.0/configuration-reference/ # -version: 2 +version: "2.1" + jobs: - test-py37: + test: + parameters: + python_version: + type: string + docker: - - image: python:3.7.2 + - image: python:<< parameters.python_version >> working_directory: ~/repo @@ -34,7 +39,14 @@ jobs: command: | . venv/bin/activate make lint - tox -e py37 + + # Set Tox environment to the installed Python version. + TOXENV=$( + python -c 'import sys; v = sys.version_info; print("py{}{}".format(v.major, v.minor))' + ) + + tox -e "$TOXENV" + codecov make test-coverage-report-console make test-coverage-report-html @@ -75,5 +87,10 @@ workflows: version: 2 ci: jobs: - - test-py37 + - test: + matrix: + parameters: + python_version: + - "3.7.2" + - "3.8.3" - dist From f4b48d19626ab886ded0ea31820b1296aaccd1f9 Mon Sep 17 00:00:00 2001 From: Jose Tomas Robles Hahn Date: Mon, 8 Jun 2020 13:25:54 -0400 Subject: [PATCH 3/3] Fix 'io_utils' test 'test_with_encoding_utf8' The issue of `tempfile.SpooledTemporaryFile.encoding` being `None` when the `encoding` parameter is `utf-8` affects only some Python versions. Ref.: https://github.com/fyntex/lib-cl-sii-python/issues/120 --- .circleci/config.yml | 1 + tests/test_libs_io_utils.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b2036456..cde09f5c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -92,5 +92,6 @@ workflows: parameters: python_version: - "3.7.2" + - "3.7.6" - "3.8.3" - dist diff --git a/tests/test_libs_io_utils.py b/tests/test_libs_io_utils.py index 7a850b3e..2a35dbd4 100644 --- a/tests/test_libs_io_utils.py +++ b/tests/test_libs_io_utils.py @@ -1,5 +1,6 @@ import io import pathlib +import sys import tempfile import unittest @@ -69,8 +70,11 @@ def test_with_encoding_utf8(self): with tempfile.SpooledTemporaryFile(mode='rt', encoding='utf-8') as f: self.assertTrue(isinstance(f, tempfile.SpooledTemporaryFile)) - # note: this is a strange case. - self.assertFalse(with_encoding_utf8(f)) + if sys.version_info[:3] >= (3, 7, 6): + self.assertTrue(with_encoding_utf8(f)) + else: + # note: this is a strange case (Python 3.7). + self.assertFalse(with_encoding_utf8(f)) # Text mode - encoding 'latin1'