-
Notifications
You must be signed in to change notification settings - Fork 24
Add Python 3.14 support #289
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
rtibbles
merged 4 commits into
learningequality:release-v0.8.x
from
rtibblesbot:issue-288-0da0e5
Mar 19, 2026
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
271592d
Add Python 3.14 support to CI and version metadata
rtibblesbot d465459
Update test dependencies for Python 3.14 compatibility
rtibblesbot 4079d93
Vendor EnvironmentVarGuard for Python 3.14 compatibility
rtibblesbot 7f6c480
Rename FacilityFactory to FacilityModelFactory
rtibblesbot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = "0.8.7" | ||
| __version__ = "0.8.8" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,6 @@ | ||
| # These are for testing | ||
| factory-boy==2.7.0 | ||
| fake-factory==0.5.7 | ||
| mock==2.0.0 | ||
| pytest==6.2.5 | ||
| factory-boy>=3.0,<4 | ||
| mock>=4.0,<6 | ||
| pytest>=6.2.5,<8 | ||
| pytest-django==4.5.2 | ||
| more-itertools<=8.10.0 | ||
| typing | ||
| more-itertools<=10.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,21 @@ | ||
| try: | ||
| # In the Python EOL GH workflows, we have to install backported version | ||
| # as the Docker container images we use does not have the test module installed. | ||
| from backports.test.support import EnvironmentVarGuard # noqa F401 | ||
| except ImportError: | ||
| try: | ||
| # For python >3.8 and <3.10 | ||
| from test.support import EnvironmentVarGuard # noqa F401 | ||
| except ImportError: | ||
| # In Python 3.10, this has been moved to test.support.os_helper | ||
| from test.support.os_helper import EnvironmentVarGuard # noqa F401 | ||
| import os | ||
| from unittest.mock import patch as _patch | ||
|
|
||
|
|
||
| class EnvironmentVarGuard: | ||
| """ | ||
| Vendored replacement for the removed test.support EnvironmentVarGuard. | ||
| Uses unittest.mock.patch.dict(os.environ) under the hood. | ||
| Supports the context-manager-with-dict-assignment pattern: | ||
| with EnvironmentVarGuard() as env: env[k] = v | ||
| """ | ||
|
|
||
| def __init__(self): | ||
| self._patcher = _patch.dict(os.environ) | ||
|
|
||
| def __enter__(self): | ||
| self._patcher.start() | ||
| return os.environ | ||
|
|
||
| def __exit__(self, *args): | ||
| self._patcher.stop() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import os | ||
| import uuid | ||
|
|
||
| from django.test import SimpleTestCase | ||
|
|
||
| from .compat import EnvironmentVarGuard | ||
|
|
||
|
|
||
| class EnvironmentVarGuardTestCase(SimpleTestCase): | ||
| """Tests for the vendored EnvironmentVarGuard.""" | ||
|
|
||
| def test_sets_env_var_inside_context(self): | ||
| key = "MORANGO_TEST_" + uuid.uuid4().hex[:8] | ||
| with EnvironmentVarGuard() as env: | ||
| env[key] = "test_value" | ||
| self.assertEqual(os.environ[key], "test_value") | ||
|
|
||
| def test_reverts_env_var_on_exit(self): | ||
| key = "MORANGO_TEST_" + uuid.uuid4().hex[:8] | ||
| with EnvironmentVarGuard() as env: | ||
| env[key] = "test_value" | ||
| self.assertNotIn(key, os.environ) | ||
|
|
||
| def test_reverts_modified_env_var_on_exit(self): | ||
| key = "MORANGO_TEST_" + uuid.uuid4().hex[:8] | ||
| os.environ[key] = "original" | ||
| try: | ||
| with EnvironmentVarGuard() as env: | ||
| env[key] = "modified" | ||
| self.assertEqual(os.environ[key], "modified") | ||
| self.assertEqual(os.environ[key], "original") | ||
| finally: | ||
| os.environ.pop(key, None) | ||
|
|
||
| def test_returns_os_environ(self): | ||
| with EnvironmentVarGuard() as env: | ||
| self.assertIs(env, os.environ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.