Skip to content

Commit

Permalink
feat: add tutor integration test DS-979 (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanttV authored Jun 12, 2024
1 parent f7c3ed1 commit 221d4fe
Show file tree
Hide file tree
Showing 13 changed files with 146 additions and 36 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Tutor Integration Tests
on: [pull_request]

jobs:
integration-test:
name: Tutor Integration Test
runs-on: ubuntu-latest
strategy:
matrix:
tutor_version: ["<17.0.0", "<18.0.0"]
steps:
- uses: actions/checkout@v4
with:
path: eox-theming
- uses: eduNEXT/integration-test-in-tutor@main
with:
tutor_version: ${{ matrix.tutor_version }}
app_name: "eox-theming"
shell_file_to_run: "eox_theming/tests/tutor/integration.sh"
12 changes: 12 additions & 0 deletions eox_theming/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

from __future__ import unicode_literals

import codecs
import os

import yaml

from .common import * # pylint: disable=wildcard-import


Expand Down Expand Up @@ -62,3 +67,10 @@ def plugin_settings(settings): # pylint: disable=function-redefined
settings.STATICFILES_FINDERS = [
x for x in settings.STATICFILES_FINDERS if 'EoxThemeFilesFinder' not in x
]

# setup the databases used in the tutor local environment
lms_cfg = os.environ.get('LMS_CFG')
if lms_cfg:
with codecs.open(lms_cfg, encoding='utf-8') as file:
env_tokens = yaml.safe_load(file)
settings.DATABASES = env_tokens['DATABASES']
Empty file.
16 changes: 16 additions & 0 deletions eox_theming/tests/tutor/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
The conftest module sets up the database connection for pytest-django.
The integration tests will reuse the database from tutor local so a noop
django_db_setup is required.
See: https://pytest-django.readthedocs.io/en/latest/database.html
"""

import pytest # pylint: disable=import-error


@pytest.fixture(scope="session")
def django_db_setup():
"""
Makes the tests reuse the existing database
"""
11 changes: 11 additions & 0 deletions eox_theming/tests/tutor/integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# This script installs the package in the edxapp environment, installs test requirements from Open edX and runs the tests using the Tutor settings.
echo "Install package"
pip install -e /openedx/eox-theming

echo "Install test-requirements"
make test-requirements

echo "Run tests"
pytest -s --ds=lms.envs.tutor.test /openedx/eox-theming/eox_theming/tests/tutor
24 changes: 24 additions & 0 deletions eox_theming/tests/tutor/integration_test_tutor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
Test integration file.
"""
from django.test import TestCase


class TutorIntegrationTestCase(TestCase):
"""
Tests integration with Open edX
"""

# pylint: disable=import-outside-toplevel, unused-import
def test_current_settings_code_imports(self):
"""
Running this imports means that our backends import the right signature
"""
# isort: off
import eox_theming.edxapp_wrapper.backends.j_configuration_helpers
import eox_theming.edxapp_wrapper.backends.j_finders
import eox_theming.edxapp_wrapper.backends.j_loaders
import eox_theming.edxapp_wrapper.backends.j_models
import eox_theming.edxapp_wrapper.backends.j_theming_helpers
import eox_theming.edxapp_wrapper.backends.l_mako
import eox_theming.edxapp_wrapper.backends.l_storage
7 changes: 7 additions & 0 deletions eox_theming/tests/tutor/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[pytest]
python_files = integration_test_*.py
filterwarnings =
default
# We ignore every warning while we actually get the testing infrastructure
# running for different version of tutor in gh actions
ignore:
16 changes: 10 additions & 6 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
asgiref==3.7.2
asgiref==3.8.1
# via django
django==4.2.9
backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# django
django==4.2.13
# via
# -c requirements/constraints.txt
# -r requirements/base.in
eox-tenant==10.0.0
eox-tenant==11.2.0
# via
# -c requirements/constraints.txt
# -r requirements/base.in
six==1.16.0
# via -r requirements/base.in
sqlparse==0.4.4
sqlparse==0.5.0
# via django
typing-extensions==4.9.0
typing-extensions==4.12.1
# via asgiref
5 changes: 4 additions & 1 deletion requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ pycodestyle<2.9.0
click<9.0

# Version used in Palm version of eox-tenant
eox-tenant>= 10.0.0
eox-tenant>= 10.0.0

# backports.zoneinfo is only needed for Python < 3.9
backports.zoneinfo; python_version<'3.9'
21 changes: 13 additions & 8 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
build==1.0.3
build==1.2.1
# via pip-tools
click==8.1.7
# via
# -c requirements/constraints.txt
# pip-tools
packaging==23.2
importlib-metadata==7.1.0
# via build
pip-tools==7.3.0
# via -r requirements/pip-tools.in
pyproject-hooks==1.0.0
packaging==24.0
# via build
pip-tools==7.4.1
# via -r requirements/pip-tools.in
pyproject-hooks==1.1.0
# via
# build
# pip-tools
tomli==2.0.1
# via
# build
# pip-tools
# pyproject-hooks
wheel==0.42.0
wheel==0.43.0
# via pip-tools
zipp==3.19.2
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
1 change: 1 addition & 0 deletions requirements/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ coverage
mako
path-py
testfixtures
pyyaml
34 changes: 21 additions & 13 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,46 +1,51 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
asgiref==3.7.2
asgiref==3.8.1
# via
# -r requirements/base.txt
# django
astroid==2.13.5
# via
# -r requirements/test.in
# pylint
coverage==7.4.0
backports-zoneinfo==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
# django
coverage==7.5.3
# via -r requirements/test.in
dill==0.3.7
dill==0.3.8
# via pylint
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
# -r requirements/test.in
eox-tenant==10.0.0
eox-tenant==11.2.0
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
isort==5.13.2
# via pylint
lazy-object-proxy==1.10.0
# via astroid
mako==1.3.0
mako==1.3.5
# via -r requirements/test.in
markupsafe==2.1.3
markupsafe==2.1.5
# via mako
mccabe==0.7.0
# via pylint
mock==5.1.0
# via -r requirements/test.in
path==16.9.0
path==16.14.0
# via path-py
path-py==12.5.0
# via -r requirements/test.in
platformdirs==4.1.0
platformdirs==4.2.2
# via pylint
pycodestyle==2.8.0
# via
Expand All @@ -50,22 +55,25 @@ pylint==2.15.10
# via
# -c requirements/constraints.txt
# -r requirements/test.in
pyyaml==6.0.1
# via -r requirements/test.in
six==1.16.0
# via -r requirements/base.txt
sqlparse==0.4.4
sqlparse==0.5.0
# via
# -r requirements/base.txt
# django
testfixtures==7.2.2
testfixtures==8.2.0
# via -r requirements/test.in
tomli==2.0.1
# via pylint
tomlkit==0.12.3
tomlkit==0.12.5
# via pylint
typing-extensions==4.9.0
typing-extensions==4.12.1
# via
# -r requirements/base.txt
# asgiref
# astroid
# pylint
wrapt==1.16.0
# via astroid
16 changes: 8 additions & 8 deletions requirements/tox.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# make upgrade
#
cachetools==5.3.2
cachetools==5.3.3
# via tox
chardet==5.2.0
# via tox
colorama==0.4.6
# via tox
distlib==0.3.8
# via virtualenv
filelock==3.13.1
filelock==3.14.0
# via
# tox
# virtualenv
packaging==23.2
packaging==24.0
# via
# pyproject-api
# tox
platformdirs==4.1.0
platformdirs==4.2.2
# via
# tox
# virtualenv
pluggy==1.3.0
pluggy==1.5.0
# via tox
pyproject-api==1.6.1
# via tox
tomli==2.0.1
# via
# pyproject-api
# tox
tox==4.12.1
tox==4.15.1
# via -r requirements/tox.in
virtualenv==20.25.0
virtualenv==20.26.2
# via tox

0 comments on commit 221d4fe

Please sign in to comment.