Skip to content

Commit

Permalink
Merge pull request #64 from dfinity/update-python
Browse files Browse the repository at this point in the history
chore(IDX): update python to 3.12
  • Loading branch information
cgundy authored Nov 28, 2024
2 parents f5524f1 + ba2df38 commit 27496fc
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'

- name: Install Dependencies
run: pip install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_cla_signed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'
- name: Install Dependencies
run: pip install -q -r requirements.txt
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python_lint_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.12'

- name: Install Dependencies
run: pip install -r requirements.txt
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ This repository contains a set of internal workflows used at DFINITY. So far thi
1. [CLA Workflow](CLA-workflow.md)

This repository is not open to external contributions.

## updating pip requirements
Start a venv:
```
python -m venv .venv
source /path/to/venv/bin/activate
```
Install pip-tools and run pip-compile:
```
pip install pip-tools
pip-compile requirements.in
```
3 changes: 2 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ github3.py
mypy
black
flake8
pytest
pytest
typing-extensions>=4.6.0 # causes issues with python 3.12 if not specified
13 changes: 3 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# pip-compile requirements.in
Expand All @@ -18,8 +18,6 @@ click==8.1.3
# via black
cryptography==43.0.1
# via pyjwt
exceptiongroup==1.2.0
# via pytest
flake8==6.0.0
# via -r requirements.in
github3-py==3.2.0
Expand Down Expand Up @@ -64,14 +62,9 @@ requests==2.32.0
# via github3-py
six==1.16.0
# via python-dateutil
tomli==2.0.1
# via
# black
# mypy
# pytest
typing-extensions==4.5.0
typing-extensions==4.12.2
# via
# black
# -r requirements.in
# mypy
uritemplate==4.1.1
# via github3-py
Expand Down
2 changes: 2 additions & 0 deletions reusable_workflows/tests/test_cla_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def test_handle_cla_signed_with_pending_label():
issue.remove_label.assert_called_once()
issue.add_labels.assert_called_once()


def test_handle_cla_signed_with_new_pending_label():
issue = mock.Mock()
label = mock.Mock()
Expand All @@ -186,6 +187,7 @@ def test_handle_cla_signed_with_new_pending_label():
issue.remove_label.assert_called_once()
issue.add_labels.assert_called_once()


def test_handle_cla_signed_with_no_label(capfd):
issue = mock.Mock()
issue.original_labels = []
Expand Down
6 changes: 4 additions & 2 deletions reusable_workflows/tests/test_compliance_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,13 @@ def test_branch_protection_enabled():
repo.default_branch = "main"
branch = mock.Mock()
branch.protected = True
helper.repo = repo
helper.repo.branch.return_value = branch
branch_protection_check = BranchProtection()

branch_protection_check.check(helper)

assert repo.branch.called_with("main")
helper.repo.branch.assert_called_with("main")
assert branch_protection_check.name == "branch_protection"
assert branch_protection_check.succeeds is True

Expand All @@ -182,12 +183,13 @@ def test_branch_protection_disabled():
repo.default_branch = "main"
branch = mock.Mock()
branch.protected = False
helper.repo = repo
helper.repo.branch.return_value = branch
branch_protection_check = BranchProtection()

branch_protection_check.check(helper)

assert repo.branch.called_with("main")
helper.repo.branch.assert_called_with("main")
assert branch_protection_check.succeeds is False


Expand Down
4 changes: 2 additions & 2 deletions reusable_workflows/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def test_download_file_succeeds_first_try():
data = download_gh_file(repo, "file_path")

assert data == "file_contents"
assert repo.file_contents.called_with("file_path")
repo.file_contents.assert_called_with("file_path")
assert repo.file_contents.call_count == 1


Expand All @@ -30,7 +30,7 @@ def test_download_file_succeeds_third_try():
data = download_gh_file(repo, "file_path")

assert data == "file_contents"
assert repo.file_contents.called_with("file_path")
repo.file_contents.assert_called_with("file_path")
assert repo.file_contents.call_count == 3


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ ignore_missing_imports = True
ignore_missing_imports = True

[flake8]
ignore = E501
ignore = E501, E701

0 comments on commit 27496fc

Please sign in to comment.