Skip to content

Commit

Permalink
Clean up package hierarchy (#381)
Browse files Browse the repository at this point in the history
* Move feditest/ubos/__init__.py to feditest/nodedrivers/ubos.py -- better location
* Move Node, NodeDriver and associated classes from feditest.protocols to feditest.nodedrivers -- much more logical location
* Fix \ missing escape in PHP string
* Add smoke tests to Makefile

---------

Co-authored-by: Johannes Ernst <[email protected]>
  • Loading branch information
jernst and Johannes Ernst authored Oct 9, 2024
1 parent 1917670 commit 8f2435b
Show file tree
Hide file tree
Showing 28 changed files with 752 additions and 739 deletions.
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ UNAME?=$(shell uname -s | tr [A-Z] [a-z])
BRANCH?=$(shell git branch --show-current)
VENV?=venv.$(UNAME).$(BRANCH)
PYTHON?=python3.11
FEDITEST?=$(VENV)/bin/feditest -v

default : all

all : build lint tests

build : venv
$(VENV)/bin/pip install .
Expand All @@ -39,9 +44,17 @@ lint : build
@# MYPYPATH is needed because apparently some type checking ignores the directory option given as command-line argument
@# $(VENV)/bin/pylint src

test : venv
tests : tests.unit tests.smoke

tests.unit : venv
$(VENV)/bin/pytest -v

tests.smoke : venv
$(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/mastodon_api.session.json --constellation tests.smoke/mastodon.ubos.constellation.json
$(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/mastodon_api.session.json --constellation tests.smoke/wordpress.ubos.constellation.json
$(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/mastodon_api_mastodon_api.session.json --constellation tests.smoke/mastodon_mastodon.ubos.constellation.json
# Currently broken: $(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/mastodon_api_mastodon_api.session.json --constellation tests.smoke/wordpress_mastodon.ubos.constellation.json

release :
@which $(PYTHON) || ( echo 'No executable called "python". Append your python to the make command, like "make PYTHON=your-python"' && false )
[[ -d venv.release ]] && rm -rf venv.release || true
Expand All @@ -54,4 +67,4 @@ release :
@echo The actual push to pypi.org you need to do manually. Enter:
@echo venv.release/bin/twine upload dist/*

.PHONY: venv build lint test release
.PHONY: all default venv build lint tests tests.unit tests.smoke release
4 changes: 2 additions & 2 deletions src/feditest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from hamcrest.core.matcher import Matcher
from hamcrest.core.string_description import StringDescription

import feditest.protocols
import feditest.nodedrivers
from feditest.reporting import fatal, warning
from feditest.tests import (
Test,
Expand Down Expand Up @@ -204,7 +204,7 @@ class XYZDriver : ...
if not _loading_node_drivers:
fatal('Do not define NodeDrivers outside of nodedriversdir')

if not issubclass(to_register,feditest.protocols.NodeDriver):
if not issubclass(to_register,feditest.nodedrivers.NodeDriver):
fatal('Cannot register an object as NodeDriver that isn\'t a subclass of NodeDriver:', to_register.__name__)

module = getmodule(to_register)
Expand Down
Loading

0 comments on commit 8f2435b

Please sign in to comment.