Skip to content
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

[Track CI] Upgrade Workflow to use Python 3.11.2 & Pytest 7.2.2 #3382

Merged
merged 15 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.10.6
python-version: 3.11.2

- name: Download & Install dependencies
run: |
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
needs: housekeeping
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, 3.10.6]
python-version: [3.7, 3.8, 3.9, 3.10.6, 3.11.2]
steps:
- uses: actions/checkout@v3

Expand All @@ -66,7 +66,7 @@ jobs:
run: pip install dataclasses

- name: Install pytest
run: pip install pytest~=7.1.2
run: pip install pytest~=7.2.2

- name: Check exercises
run: |
Expand Down
11 changes: 9 additions & 2 deletions bin/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
from itertools import chain
import json
from pathlib import Path
import tomli
from typing import List, Any, Dict, Type

# Tomli was subsumed into Python 3.11.x, but was renamed to to tomllib.
# This avoids ci failures for Python < 3.11.2.
try:
import tomllib
except ModuleNotFoundError:
import tomli as tomllib



def _custom_dataclass_init(self, *args, **kwargs):
# print(self.__class__.__name__, "__init__")
Expand Down Expand Up @@ -355,7 +362,7 @@ class TestsTOML:
@classmethod
def load(cls, toml_path: Path):
with toml_path.open("rb") as f:
data = tomli.load(f)
data = tomllib.load(f)
return cls({uuid: TestCaseTOML(uuid, *opts) for
uuid, opts in
data.items() if
Expand Down
8 changes: 7 additions & 1 deletion bin/generate_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@
from itertools import repeat
from string import punctuation, whitespace
from subprocess import check_call
import tomli
from tempfile import NamedTemporaryFile
from textwrap import wrap
from typing import Any, Dict, List, NoReturn, Union

# Tomli was subsumed into Python 3.11.x, but was renamed to to tomllib.
# This avoids ci failures for Python < 3.11.2.
try:
import tomllib
except ModuleNotFoundError:
import tomli as tomllib

from jinja2 import Environment, FileSystemLoader, TemplateNotFound, UndefinedError
from dateutil.parser import parse

Expand Down
20 changes: 8 additions & 12 deletions exercises/practice/paasio/paasio_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,13 @@ def test_meteredsocket_stats_read_only(self):
self.assertEqual(282, socket.send_bytes)
self.assertEqual(258, socket.recv_ops)
self.assertEqual(259, socket.recv_bytes)
with self.assertRaisesRegex(AttributeError, "can't set"):
with self.assertRaises(AttributeError, msg="property 'send_ops' of 'MeteredSocket' object has no setter"):
socket.send_ops = 0
with self.assertRaisesRegex(AttributeError, "can't set"):
with self.assertRaises(AttributeError, msg="property 'send_bytes' of 'MeteredSocket' object has no setter"):
socket.send_bytes = 0
with self.assertRaisesRegex(AttributeError, "can't set"):
with self.assertRaises(AttributeError, msg="property 'recv_ops' of 'MeteredSocket' object has no setter"):
socket.recv_ops = 0
with self.assertRaisesRegex(AttributeError, "can't set"):
with self.assertRaises(AttributeError, msg="property 'recv_bytes' of 'MeteredSocket' object has no setter"):
socket.recv_bytes = 0
self.assertEqual(278, socket.send_ops)
self.assertEqual(282, socket.send_bytes)
Expand Down Expand Up @@ -426,19 +426,15 @@ def test_meteredfile_stats_read_only(self, super_mock):
file.write(b"bytes")
self.assertEqual(78, file.write_ops)
self.assertEqual(82, file.write_bytes)
with self.assertRaisesRegex(AttributeError, "can't set"):
with self.assertRaises(AttributeError, msg="property 'write_ops' of 'MeteredFile' object has no setter"):
file.write_ops = 0
with self.assertRaisesRegex(AttributeError, "can't set"):
with self.assertRaises(AttributeError, msg="property 'write_bytes' of 'MeteredFile' object has no setter"):
file.write_bytes = 0
with self.assertRaisesRegex(AttributeError, "can't set"):
with self.assertRaises(AttributeError, msg="property 'read_ops' of 'MeteredFile' object has no setter"):
file.read_ops = 0
with self.assertRaisesRegex(AttributeError, "can't set"):
with self.assertRaises(AttributeError, msg="property 'read_bytes' of 'MeteredFile' object has no setter"):
file.read_bytes = 0
self.assertEqual(78, file.write_ops)
self.assertEqual(82, file.write_bytes)
self.assertEqual(58, file.read_ops)
self.assertEqual(59, file.read_bytes)


if __name__ == "__main__":
unittest.main()
4 changes: 2 additions & 2 deletions requirements-generator.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
black==22.3.0
black<=22.3.0
flake8~=5.0.4
Jinja2~=3.1.2
python-dateutil==2.8.1
markupsafe==2.0.1
tomli~=2.0.1
tomli>=1.1.0; python_full_version < '3.11.2'
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
astroid<=2.12.0
flake8~=5.0.4
pylint~=2.14.5
pylint~=2.17.1
black<=22.3.0
yapf~=0.32.0
tomli~=2.0.1
tomli>=1.1.0; python_full_version < '3.11.2'