From cae231eddf46d3e136e229bafadc2994f3ae83a9 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Wed, 8 Mar 2023 14:17:06 +0100 Subject: [PATCH] wip --- .github/workflows/test.yml | 54 ++++++++++++++++++++++++++------------ docs/SUMMARY.md | 1 + docs/testing.md | 16 +++++++++++ 3 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 docs/testing.md diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e93c9bc..4153821 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,12 +4,21 @@ on: [push, pull_request] jobs: test: - # Older Ubuntu required for testing on Python 3.6 which is not available in - # later versions. Remove once support for 3.6 is dropped. - runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.11"] + + # https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - uses: actions/checkout@v3 @@ -17,17 +26,28 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies + - name: Install Mastodon run: | - python -m pip install --upgrade pip - pip install -e . - pip install -r requirements-test.txt - - name: Run tests - run: | - pytest - - name: Validate minimum required version - run: | - vermin --target=3.6 --no-tips . - - name: Check style - run: | - flake8 + wget https://github.com/mastodon/mastodon/archive/refs/tags/v4.1.0.zip + unzip v4.1.0.zip + cd mastodon-4.1.0 + ls -al + - name: Run integration tests + env: + TOOT_TEST_HOSTNAME: localhost:3000 + TOOT_TEST_DATABASE_DSN: dbname=mastodon_development + + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install -e . + # pip install -r requirements-test.txt + # - name: Run tests + # run: | + # pytest + # - name: Validate minimum required version + # run: | + # vermin --target=3.6 --no-tips . + # - name: Check style + # run: | + # flake8 diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index da4170b..c092e06 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -9,6 +9,7 @@ - [Contributing](contributing.md) - [Documentation](documentation.md) - [Release procedure](release.md) + - [Running tests](testing.md) - [Changelog](changelog.md) [License](license.md) diff --git a/docs/testing.md b/docs/testing.md new file mode 100644 index 0000000..a180a26 --- /dev/null +++ b/docs/testing.md @@ -0,0 +1,16 @@ +Running tests +============= + +Run unit tests by just invoking: + +``` +pytest +``` + +However, many tests are implemented as integration tests which require a local +mastodon instance to be running. + +## Setting up a test mastodon instance + + +