test: add CI (#329)
Some checks are pending
Python Formatting Check / formatting (push) Waiting to run
Tests / Run tests (3.12) (push) Waiting to run
Tests / Run tests (3.8) (push) Waiting to run

This adds two CI runs: a quick one that happens for every pull
request and merge to master, and a longer one that happens daily.

This also adds a new installation group to setup.py because the
`easy` group isn't currently installable, and some of the dependencies
specified there need to be present for the tests to run.
This commit is contained in:
Misty De Méo 2025-03-04 09:34:23 -08:00 committed by GitHub
parent 984a129b43
commit c59b08df33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 106 additions and 7 deletions

View file

@ -18,14 +18,24 @@ limitations under the License.
"""
import brozzler.cli
import pkg_resources
import importlib.metadata
import pytest
import subprocess
import doublethink
def console_scripts():
# We do a dict comprehension here because the select filters aren't
# available until Python 3.10's importlib.
return {
ep.name: ep
for ep in importlib.metadata.distribution("brozzler").entry_points
if ep.group == "console_scripts"
}
def cli_commands():
commands = set(pkg_resources.get_entry_map("brozzler")["console_scripts"].keys())
commands = set(console_scripts().keys())
commands.remove("brozzler-wayback")
try:
import gunicorn
@ -40,8 +50,8 @@ def cli_commands():
@pytest.mark.parametrize("cmd", cli_commands())
def test_call_entrypoint(capsys, cmd):
entrypoint = pkg_resources.get_entry_map("brozzler")["console_scripts"][cmd]
callable = entrypoint.resolve()
entrypoint = console_scripts()[cmd]
callable = entrypoint.load()
with pytest.raises(SystemExit):
callable(["/whatever/bin/%s" % cmd, "--version"])
out, err = capsys.readouterr()