Skip to content

Commit

Permalink
chore: re-organise test app
Browse files Browse the repository at this point in the history
- move example to test/testapp
- consolidate tests in one location
  • Loading branch information
zerolab authored and dopry committed May 12, 2023
1 parent 4e0a512 commit 4aab63c
Show file tree
Hide file tree
Showing 61 changed files with 991 additions and 1,554 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,29 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
tests/requirements.txt
- name: Install Dependencies
run: |
pip install -r requirements.txt
pip install .
cd tests
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Install Wagtail package
if: ${{ matrix.wagtail-version != 'main' }}
run: |
pip install wagtail==${{ matrix.wagtail-version }}
python -m pip install wagtail==${{ matrix.wagtail-version }}
- name: Install Wagtail main
if: ${{ matrix.wagtail-version == 'main' }}
run: |
git clone https://github.com/wagtail/wagtail.git
pip install ./wagtail
python -m pip install ./wagtail
- name: Run Tests
run: |
cd example
cd tests
python manage.py migrate
python manage.py test
Expand All @@ -76,15 +79,16 @@ jobs:
python-version: 3.8
cache: 'pip'
cache-dependency-path: |
requirements-channels.txt
tests/requirements-channels.txt
- name: Install Dependencies
run: |
pip install -r requirements-channels.txt
pip install .
cd tests
python -m pip install --upgrade pip
python -m pip install -r requirements-channels.txt
- name: Run Tests
run: |
cd example
cd tests
python manage.py migrate
python manage.py test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
### Django ###
*.log
*.pot
*.pyc
__pycache__/
local_settings.py
media
Expand Down Expand Up @@ -139,3 +138,7 @@ Temporary Items
*.sublime-workspace
.vscode
.idea


# wagtail
static/
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ COPY ./requirements-channels.txt /code/requirements-channels.txt
COPY ./requirements.txt /code/requirements.txt

# copy example site requires file
COPY ./example/requirements.txt /code/example/requirements.txt
COPY ./example/requirements-channels.txt /code/example/requirements-channels.txt
COPY ./tests/requirements.txt /code/tests/requirements.txt
COPY ./tests/requirements-channels.txt /code/tests/requirements-channels.txt

WORKDIR /code/example
WORKDIR /code/tests

RUN pip install --upgrade pip
# Install any needed packages specified in requirements.txt
RUN pip install -r ./requirements-channels.txt
RUN pip install gunicorn

# Copy the current directory contents into the container at /code/
COPY ./example /code/example
COPY ./tests /code/tests
# Set the working directory to /code/

RUN python manage.py migrate
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,23 +175,22 @@ Any contributions [you make](https://github.com/torchbox/wagtail-grapple/graphs/

### Local development

#### With SQLite
- In the Python environment of your choice, navigate to `/example`
- Run `pip install -r requirements.txt`
- Run `./manage.py migrate`
- Run server `./manage.py runserver`
- Run tests `./manage.py test`
- In the Python environment of your choice, navigate to `tests/`
- Run `python -m pip install -r requirements.txt`
- Run `python manage.py migrate`
- Run server `python manage.py runserver`
- Run tests `python manage.py test`

#### With Postgres

- In the Python environment of your choice, navigate to `/example`
- Run `pip install -r requirements.txt`
- Ensure you have docker and docker compose
- Run `docker compose up`
- Run `export DATABASE_URL="postgres://postgres:postgres@localhost/postgres"`
- Run `./manage.py migrate`
- Run server `./manage.py runserver`
- Run tests `./manage.py test`
- In the Python environment of your choice, navigate to `tests/`
- Run `python -m pip install -r requirements.txt`
- Run `python manage.py migrate`
- Run server `python manage.py runserver`
- Run tests `python manage.py test`

## Compatibility

Expand Down
83 changes: 0 additions & 83 deletions example/documents/migrations/0001_initial.py

This file was deleted.

12 changes: 0 additions & 12 deletions example/documents/models.py

This file was deleted.

Empty file removed example/example/__init__.py
Empty file.
Empty file.
18 changes: 0 additions & 18 deletions example/example/settings/dev.py

This file was deleted.

8 changes: 0 additions & 8 deletions example/example/settings/production.py

This file was deleted.

Empty file.
Empty file.
Empty file removed example/example/tests/__init__.py
Empty file.
Empty file removed example/home/__init__.py
Empty file.
Loading

0 comments on commit 4aab63c

Please sign in to comment.