-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding integration tests with inlines * Adding more tests * FIx make file * Setup CI build matrix to work with integration tests * Try again * Fix workflow synctax * Clean up workflow * Format and some lint stuff * Try codecov * yml * More Testing * Minor lint things * Update * Try again for codecov * Updates * Try? * Ignore quotes * Exclude test project * try this? * checkout required * Rename * clean up configs * Fix * Allow to fail * ignores * FInish the integration tests for cache * Fix workflow yml * fix * Try up again * TRy again * Fix * Fix * Fix tests Co-authored-by: Thu Trang Pham <[email protected]>
- Loading branch information
Showing
31 changed files
with
677 additions
and
185 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
PYTHON_VERSION=3.8 | ||
DJANGO_VERSION=3.1.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,47 +14,41 @@ on: | |
- created | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: wemake-python-styleguide | ||
uses: wemake-services/[email protected] | ||
with: | ||
path: admin_confirm | ||
reporter: 'github-pr-review' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
continue-on-error: true | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
django-version: [2.2, 3.0] | ||
env: | ||
DJANGO_VERSION: ${{ matrix.django-version }} | ||
PYTHON_VERSION: ${{ matrix.python-version }} | ||
COMPOSE_INTERACTIVE_NO_CLI: 1 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Django ${{ matrix.django-version }} | ||
run: | | ||
pip install django==${{ matrix.django-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
- name: Build Docker for Python 3.6 | ||
if: ${{ matrix.python-version == 3.6 }} | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Unit Test | ||
export SELENIUM_VERSION=3.141.0 | ||
docker-compose build | ||
- name: Build Docker for other Python versions | ||
if: ${{ matrix.python-version != 3.6 }} | ||
run: | | ||
make test | ||
- name: Coveralls | ||
uses: AndreMiras/coveralls-python-action@develop | ||
with: | ||
parallel: true | ||
flag-name: Unit Test | ||
|
||
integration-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build Docker | ||
run: docker-compose build | ||
export SELENIUM_VERSION=4.0.0a7 | ||
docker-compose build | ||
- name: Start Docker | ||
run: docker-compose up -d | ||
- name: Integration Test | ||
|
@@ -63,10 +57,9 @@ jobs: | |
uses: AndreMiras/coveralls-python-action@develop | ||
with: | ||
parallel: true | ||
flag-name: Integration Test | ||
|
||
coveralls: | ||
needs: [test, integration-test] | ||
needs: [test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Coveralls Finished | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
FROM python:3 | ||
ARG PYTHON_VERSION=3.8 | ||
FROM python:${PYTHON_VERSION} | ||
ENV PYTHONUNBUFFERED=1 | ||
ENV USE_DOCKER=true | ||
WORKDIR /code | ||
COPY requirements.txt /code/ | ||
RUN pip install -r requirements.txt | ||
COPY . /code/ | ||
ARG DJANGO_VERSION="3.1.7" | ||
RUN pip install django==${DJANGO_VERSION} | ||
RUN pip install -r requirements.txt | ||
RUN pip install -e . | ||
ARG SELENIUM_VERSION="4.0.0a7" | ||
RUN pip install selenium~=${SELENIUM_VERSION} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import socket | ||
|
||
from django.core.cache import cache | ||
from django.test import TestCase, RequestFactory | ||
from django.contrib.auth.models import User | ||
from django.test import LiveServerTestCase | ||
from selenium import webdriver | ||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | ||
|
||
|
||
class AdminConfirmTestCase(TestCase): | ||
""" | ||
|
@@ -62,23 +68,36 @@ def _assertFormsetsFormHtml(self, rendered_content, inlines): | |
self.assertIn("apple", rendered_content) | ||
|
||
|
||
|
||
import socket | ||
from django.test import LiveServerTestCase | ||
from selenium import webdriver | ||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | ||
|
||
|
||
class AdminConfirmIntegrationTestCase(LiveServerTestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
|
||
cls.host = socket.gethostbyname(socket.gethostname()) | ||
cls.selenium = webdriver.Remote( | ||
command_executor="http://selenium:4444/wd/hub", | ||
desired_capabilities=DesiredCapabilities.FIREFOX, | ||
) | ||
super().setUpClass() | ||
|
||
def setUp(self): | ||
self.superuser = User.objects.create_superuser( | ||
username="super", email="[email protected]", password="pass" | ||
) | ||
self.client.force_login(self.superuser) | ||
|
||
cookie = self.client.cookies["sessionid"] | ||
self.selenium.get( | ||
self.live_server_url + "/admin/" | ||
) # selenium will set cookie domain based on current page domain | ||
self.selenium.add_cookie( | ||
{"name": "sessionid", "value": cookie.value, "secure": False, "path": "/"} | ||
) | ||
return super().setUp() | ||
|
||
def tearDown(self): | ||
cache.clear() | ||
return super().tearDown() | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
cls.selenium.quit() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.