Skip to content

Commit

Permalink
dev/test: handful of smallish fixes (#15680)
Browse files Browse the repository at this point in the history
* test: remove unneeded fixtures

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* feat(docs/dev): add make target for live reloading

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* chore(dev): update to latest localstack release

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

* fix(dev): use correct scheduler for embedded beat

When running celery with the embedded `beat` process, passing the
scheduler must be the full parameter.

Resolves error seen in dev:

    AttributeError: 'PersistentScheduler' object has no attribute 'lock_key'

Signed-off-by: Mike Fiedler <miketheman@gmail.com>

---------

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
  • Loading branch information
miketheman committed Mar 28, 2024
1 parent 4b8b968 commit 7f47a84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ services:
image: redis:4.0

localstack:
image: localstack/localstack:1.4
image: localstack/localstack:3.2
stop_signal: SIGKILL
environment:
SERVICES: "sqs"
Expand Down Expand Up @@ -147,7 +147,7 @@ services:
worker:
image: warehouse:docker-compose
pull_policy: never
command: hupper -m celery -A warehouse worker -B -S redbeat.RedBeatScheduler -l info
command: hupper -m celery -A warehouse worker --beat --scheduler redbeat.RedBeatScheduler -l info
volumes:
- ./warehouse:/opt/warehouse/src/warehouse:z
- packages:/var/opt/warehouse/packages
Expand Down
4 changes: 4 additions & 0 deletions docs/dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,7 @@ pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

# https://github.com/sphinx-doc/sphinx-autobuild#using-with-makefile
livehtml:
sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 changes: 7 additions & 7 deletions tests/functional/legacy_api/test_xmlrpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,47 @@
import pytest


def test_xmlrpc_raises_fault(app_config, webtest, metrics):
def test_xmlrpc_raises_fault(webtest):
with pytest.raises(xmlrpc.client.Fault):
webtest.xmlrpc("/pypi", "list_packages", "one", "two")


def test_xmlrpc_nomethod(app_config, webtest, metrics):
def test_xmlrpc_nomethod(webtest, metrics):
with pytest.raises(xmlrpc.client.Fault):
webtest.xmlrpc("/pypi", "multipassssss")
assert metrics.increment.calls == []
assert metrics.timed.calls == []


def test_xmlrpc_succeeds(app_config, webtest, metrics):
def test_xmlrpc_succeeds(webtest):
webtest.xmlrpc("/pypi", "changelog_last_serial")


def test_invalid_arguments(app_config, webtest):
def test_invalid_arguments(webtest):
with pytest.raises(
xmlrpc.client.Fault,
match=r"client error; package_name: Missing required argument",
):
webtest.xmlrpc("/pypi", "package_releases")


def test_excess_arguments(app_config, webtest):
def test_excess_arguments(webtest):
with pytest.raises(
xmlrpc.client.Fault,
match=r"client error; 1: Unexpected positional argument",
):
webtest.xmlrpc("/pypi", "changelog_last_serial", 1)


def test_arguments_with_wrong_type(app_config, webtest):
def test_arguments_with_wrong_type(webtest):
with pytest.raises(
xmlrpc.client.Fault,
match=r"client error; serial: Input should be a valid integer",
):
webtest.xmlrpc("/pypi", "changelog_since_serial", "wrong!")


def test_multiple_garbage_types(app_config, webtest):
def test_multiple_garbage_types(webtest):
with pytest.raises(
xmlrpc.client.Fault,
match=(
Expand Down

0 comments on commit 7f47a84

Please sign in to comment.