Skip to content

Commit

Permalink
Use importlib.reload instead of imp.reload (Python 3.12 compat) (#211)
Browse files Browse the repository at this point in the history
* Prefer importlib.reload to imp.reload

In aeidon/test/test_locales.py, use importlib.reload where available
(Python 3.4 and later) instead of imp.reload; the imp module has been
deprecated since Python 3.4 and is removed in Python 3.12, so this is a
Python 3.12 compatibility fix.

* Do not claim to support Python versions before 3.4
  • Loading branch information
musicinmybrain committed Jun 28, 2023
1 parent 166e1ca commit 9c9522c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ and gettext to build the Flatpak.

#### Source

Gaupol requires Python ≥ 3.2, PyGObject ≥ 3.12 and GTK ≥ 3.12.
Gaupol requires Python ≥ 3.4, PyGObject ≥ 3.12 and GTK ≥ 3.12.
Additionally, during installation you need gettext. Optional, but
strongly recommended dependencies include:

Expand Down
6 changes: 3 additions & 3 deletions aeidon/test/test_locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import aeidon
import imp
import importlib

from aeidon.i18n import _, d_
from unittest.mock import patch
Expand Down Expand Up @@ -46,10 +46,10 @@ def test_get_system_code(self):

@patch.dict("os.environ", dict(LANGUAGE="sr@Latn"))
def test_get_system_modifier__latn(self):
imp.reload(aeidon.locales)
importlib.reload(aeidon.locales)
assert aeidon.locales.get_system_modifier() == "Latn"

@patch.dict("os.environ", dict(LANGUAGE="en"))
def test_get_system_modifier__none(self):
imp.reload(aeidon.locales)
importlib.reload(aeidon.locales)
assert aeidon.locales.get_system_modifier() is None

0 comments on commit 9c9522c

Please sign in to comment.