blob: a3fff246b6161f64eb6358cd23b25d7d0d67f5a5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Mon, 24 May 2021 08:35:13 +0200
Subject: [PATCH] Force using importlib_resources in Python < 3.9
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.
https://github.com/jaraco/cssutils/pull/10
--- a/cssutils/tests/basetest.py
+++ b/cssutils/tests/basetest.py
@@ -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
|