Skip to content

Commit

Permalink
Merge 137f015 into fd857ea
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] committed Apr 8, 2024
2 parents fd857ea + 137f015 commit a31d872
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ help:
@echo " migrate run the kinto migrations"
@echo " lint run the code linters"
@echo " tests run all the tests with all the supported python interpreters (same as CI)"
@echo " test-deps pulls and runs docker postgres and memcached containers for tests"
@echo " tdd run pytest-watch to rerun tests automatically on changes for tdd"
@echo " tests-once only run the tests once with the default python interpreter"
@echo " tests-once only run the tests once with the default python interpreter"
@echo " functional run functional test against a real kinto"
@echo " browser-test run browser test against a real kinto"
@echo " clean remove *.pyc files and __pycache__ directory"
Expand Down Expand Up @@ -94,6 +95,14 @@ tests: install-postgres install-monitoring install-memcached version-file instal
tests-raw: version-file install-dev
$(VENV)/bin/py.test

test-deps:
docker pull memcached
docker pull postgres
docker run -p 11211:11211 --name kinto-memcached -d memcached || echo "cannot start memcached, already exists?"
docker run -p 5432:5432 --name kinto-postgres -e POSTGRES_PASSWORD=postgres -d postgres || echo "cannot start postgres, already exists?"
sleep 2
PGPASSWORD=postgres psql -c "CREATE DATABASE testdb ENCODING 'UTF8' TEMPLATE template0;" -U postgres -h localhost

lint: install-dev
$(VENV)/bin/ruff check kinto tests docs/conf.py
$(VENV)/bin/ruff format --check kinto tests docs/conf.py
Expand Down Expand Up @@ -123,6 +132,8 @@ clean:
find . -name '*.pyc' -delete
find . -name '__pycache__' -type d | xargs rm -fr
rm -fr docs/_build/
docker rm -f kinto-memcached || echo ""
docker rm -f kinto-postgres || echo ""

distclean: clean
rm -fr *.egg *.egg-info/ dist/ build/
Expand Down
4 changes: 2 additions & 2 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ plaster-pastedeploy==1.0.1
# via pyramid
playwright==1.42.0
# via -r constraints.in
pluggy==1.3.0
pluggy==1.4.0
# via pytest
psycopg2==2.9.9
# via -r constraints.in
Expand All @@ -121,7 +121,7 @@ pyramid-multiauth==1.0.2
# via -r constraints.in
pyramid-tm==2.5
# via -r constraints.in
pytest==7.4.4
pytest==8.1.1
# via
# -r constraints.in
# pytest-cache
Expand Down
2 changes: 1 addition & 1 deletion docs/community.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Get started!

git clone git@github.com:your_name_here/kinto.git

3. Setup a local PostgreSQL database for the tests (:ref:`more details <postgresql-install>`)::
3. Run ``make test-deps``, or setup a local PostgreSQL database (:ref:`more details <postgresql-install>`)::

sudo apt-get install postgresql
sudo -n -u postgres -s -- psql -c "ALTER USER postgres WITH PASSWORD 'postgres';" -U postgres
Expand Down
9 changes: 9 additions & 0 deletions tests/core/resource/test_views_cors.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def setUpClass(cls):
super().setUpClass()
cls.headers["Origin"] = "notmyidea.org"

@classmethod
def tearDownClass(cls):
cls.headers.pop("Origin", None)

def setUp(self):
super().setUp()
body = {"data": MINIMALIST_OBJECT}
Expand Down Expand Up @@ -217,6 +221,11 @@ def setUpClass(cls):
super().setUpClass()
cls.headers.update({"Origin": "lolnet.org", "Access-Control-Request-Method": "GET"})

@classmethod
def tearDownClass(cls):
cls.headers.pop("Access-Control-Request-Method", None)
cls.headers.pop("Origin", None)

def test_cors_max_age_is_3600_seconds_by_default(self):
app = self.make_app()
resp = app.options("/", headers=self.headers)
Expand Down
File renamed without changes.

0 comments on commit a31d872

Please sign in to comment.