Skip to content

Commit 1bad936

Browse files
authored
Merge pull request #422 from datacamp/cp-4785-add-support-for-python-3.12
[CP-4785] Add support for Python 3.12
2 parents bdfc43c + b8b255b commit 1bad936

File tree

8 files changed

+24
-28
lines changed

8 files changed

+24
-28
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ orbs:
66
jobs:
77
build-and-test:
88
docker:
9-
- image: cimg/python:3.9
9+
- image: cimg/python:3.12
1010
steps:
1111
- checkout
1212
- python/install-packages:

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,16 @@ To learn how to include an SCT in a DataCamp course, visit https://instructor-su
5353
## Run tests
5454

5555
```bash
56-
pyenv local 3.9.6
57-
pip3.9 install -r requirements-test.txt
58-
pip3.9 install -e .
56+
pyenv local 3.12.7
57+
pip3.12 install -r requirements-test.txt
58+
pip3.12 install -e .
5959
pytest
6060
```
6161

6262
## Contributing
6363

6464
Bugs? Questions? Suggestions? [Create an issue](https://github.com/datacamp/pythonwhat/issues/new), or [contact us](mailto:[email protected])!
6565

66-
6766
## License
6867

6968
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fdatacamp%2Fpythonwhat?ref=badge_large)

pythonwhat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = "2.29.0"
1+
__version__ = "2.30.0"
22

33
from .test_exercise import test_exercise, allow_errors

pythonwhat/checks/check_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def check_keys(state, key, missing_msg=None, expand_msg=None):
354354

355355
def get_part(name, key, highlight):
356356
if isinstance(key, str):
357-
slice_val = ast.Str(s=key)
357+
slice_val = ast.Constant(value=key)
358358
else:
359359
slice_val = ast.parse(str(key)).body[0].value
360360
expr = ast.Subscript(

pythonwhat/local.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def run_code(self, code):
2929
class StubProcess:
3030
def __init__(self, init_code=None, pid=None):
3131
self.shell = StubShell(init_code)
32-
self._identity = (pid,) if pid else (random.randint(0, 1e12),)
32+
self._identity = (pid,) if pid else (random.randint(0, int(1e12)),)
3333

3434
def executeTask(self, task):
3535
return task(self.shell)
@@ -73,7 +73,7 @@ def __init__(self, pid=None):
7373
) # when parent process is killed, sub/childprocess get also killed
7474
self.instances.append(self)
7575
# used to detect single process exercise
76-
self._identity = (pid,) if pid else (random.randint(0, 1e12),)
76+
self._identity = (pid,) if pid else (random.randint(0, int(1e12)),)
7777

7878
def get_shell(self):
7979
return create({})

requirements-test.txt

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
-r requirements.txt
22

33
# test deps
4-
scipy~=1.13.1
4+
scipy~=1.14.1
55
bs4~=0.0.1
66
html5lib~=1.1
7-
# h5py~=3.1.0
8-
requests~=2.26.0
7+
requests~=2.31.0
98
seaborn~=0.11.2
10-
sqlalchemy~=1.4.23
9+
sqlalchemy~=2.0.29
1110
xlrd~=2.0.1
12-
openpyxl~=3.0.7
13-
h5py~=3.11.0
11+
openpyxl~=3.1.0
12+
h5py~=3.12.1
1413

1514
# test-utils deps
16-
pytest~=6.2.5
17-
pytest-cov~=2.12.1
15+
pytest~=8.1.1
16+
pytest-cov~=6.1.1
1817

1918
# not included in requirements.txt
20-
numpy~=1.26.0
21-
pandas~=1.5.3
19+
numpy~=2.0.2
20+
pandas~=2.2.3

requirements.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# pythonwhat deps
2-
protowhat~=2.2.0
2+
protowhat~=2.3.1
33
asttokens~=2.4.1
44
dill~=0.3.4
5-
markdown2~=2.4.13
5+
markdown2~=2.5.3
66
jinja2~=3.1.3
7-
markupsafe==2.1.5
87
black==19.10b0
9-
Pygments==2.13.0

tests/test_check_function.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ def my_fun(a, b, *args, **kwargs): pass
9292
][0]["args"]
9393
sig = signature(my_fun)
9494
bound_args = bind_args(sig, args)
95-
assert bound_args["a"]["node"].n == 1
96-
assert bound_args["b"]["node"].n == 2
97-
assert bound_args["args"][0]["node"].n == 3
98-
assert bound_args["args"][1]["node"].n == 4
99-
assert bound_args["kwargs"]["c"]["node"].n == 5
95+
assert bound_args["a"]["node"].value == 1
96+
assert bound_args["b"]["node"].value == 2
97+
assert bound_args["args"][0]["node"].value == 3
98+
assert bound_args["args"][1]["node"].value == 4
99+
assert bound_args["kwargs"]["c"]["node"].value == 5
100100

101101

102102
@pytest.mark.parametrize("argspec", [["args", 0], ["args", 1], ["kwargs", "c"]])

0 commit comments

Comments
 (0)