Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Changelog

- Add support for Python 3.10, 3.11.

- Replace pkg_resources with importlib.resources

- Switch from pkg_resources to pep420 namespace package declaration

- Drop testing against ``Firefox`` in GitHub Actions: I was unable to solve the
*API rate limit exceeded* problem.

Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[pytest]
addopts = src/gocept/selenium --cov=src/gocept/selenium --instafail
python_files = test[s|_]*.py
consider_namespace_packages = True
filterwarnings =
error
ignore::pytest.PytestUnraisableExceptionWarning
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
from setuptools import find_packages
from setuptools import find_namespace_packages
from setuptools import setup


install_requires = [
'gocept.httpserverlayer >= 3',
'httpagentparser',
'importlib-resources',
'plone.testing >= 7.0',
'selenium >= 4',
'Pillow',
'setuptools',
'webdriver-manager',
]

Expand Down Expand Up @@ -58,12 +56,11 @@
open('HACKING.rst').read() +
'\n\n' +
open('CHANGES.rst').read()),
packages=find_packages('src'),
packages=find_namespace_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
zip_safe=False,
license='ZPL 2.1',
namespace_packages=['gocept'],
python_requires='>=3.7, <4',
install_requires=install_requires,
extras_require=dict(
Expand Down
20 changes: 0 additions & 20 deletions src/gocept/__init__.py

This file was deleted.

6 changes: 3 additions & 3 deletions src/gocept/selenium/screenshot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from PIL import Image
from PIL import ImageChops
import importlib_resources
import importlib.resources
import inspect
import itertools
import math
Expand All @@ -13,7 +13,7 @@


def get_path(resource):
return importlib_resources.files('gocept.selenium') / resource
return importlib.resources.files('gocept.selenium') / resource


WHITE = (255, 255, 255, 0)
Expand Down Expand Up @@ -215,7 +215,7 @@ def _screenshot_path(screenshot_directory):
if screenshot_directory == '.':
screenshot_directory = \
inspect.currentframe().f_back.f_back.f_back.f_globals['__name__']
return importlib_resources.files(screenshot_directory)
return importlib.resources.files(screenshot_directory)


def save_screenshot_temporary(screenshot):
Expand Down
8 changes: 4 additions & 4 deletions src/gocept/selenium/tests/test_wd_selenese.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import gocept.httpserverlayer.static
import gocept.selenium
import gocept.testing.assertion
import importlib_resources
import importlib.resources
import os.path
import pytest
import shutil
Expand Down Expand Up @@ -98,7 +98,7 @@ class HTMLTestCase(gocept.selenium.webdriver.WebdriverSeleneseTestCase,

def setUp(self):
super().setUp()
directory = importlib_resources.files('gocept.selenium.tests.fixture')
directory = importlib.resources.files('gocept.selenium.tests.fixture')
for glob in ('*.html', '*.pdf'):
for name in directory.glob(glob):
shutil.copy(directory / name, self.layer['documentroot'])
Expand Down Expand Up @@ -383,7 +383,7 @@ class ScreenshotDirectorySettingTest(HTMLTestCase):

def test_default_setting_when_not_set(self):
# the default is the directory where the current test is
img = str(importlib_resources.files(self.__module__) / 'foo.png')
img = str(importlib.resources.files(self.__module__) / 'foo.png')
self.selenium.capture_screenshot = True
self.selenium.open('screenshot.html')
with self.assertRaisesRegex(ValueError, img):
Expand All @@ -394,7 +394,7 @@ def test_default_setting_when_not_set(self):
def test_screenshot_directory_setting_resolves_dotted_name(self):
directory = 'gocept.selenium.tests.screenshot_directory'
self.selenium.screenshot_directory = directory
img = str(importlib_resources.files(directory) / 'foo.png')
img = str(importlib.resources.files(directory) / 'foo.png')
self.selenium.capture_screenshot = True
self.selenium.open('screenshot.html')
with self.assertRaisesRegex(ValueError, img):
Expand Down