Skip to content

Commit

Permalink
Force using importlib_resources in Python < 3.9
Browse files Browse the repository at this point in the history
Force using the external importlib_resources package based on Python
version rather than the presence of the built-in importlib.resources.
The latter does not have the needed files() method in Python < 3.9,
and therefore results in test failures:

  E       AttributeError: module 'importlib.resources' has no attribute 'files'

This affects specifically Python 3.7 and 3.8 that have an older version
of importlib.resources module.
  • Loading branch information
mgorny committed May 24, 2021
1 parent 4317993 commit 7a5274c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cssutils/tests/basetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import sys
import unittest

try:
if sys.version_info >= (3, 9):
from importlib import resources
except ImportError:
else:
import importlib_resources as resources

import cssutils
Expand Down

0 comments on commit 7a5274c

Please sign in to comment.