Skip to content

Commit

Permalink
build: Add basic testing via tox
Browse files Browse the repository at this point in the history
For now, only test PEP 8 compliance with flake8 (in the flake8
testenv), and test installing and enabling the plugin in a Tutor
environment (in the default testenv, to be invoked as "py38", "py39"
etc.)
  • Loading branch information
foadlind committed Mar 1, 2022
1 parent d550c39 commit 83d0148
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 4 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
TODO
__pycache__
*.egg-info/
.eggs/
/build/
/dist/
.idea
.idea
.python-version
.tox
tests/tutor-sandbox/config.yml
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def load_readme():
url="https://github.com/hastexo/tutor-contrib-retirement",
project_urls={
"Code": "https://github.com/hastexo/tutor-contrib-retirement",
"Issue tracker": "https://github.com/hastexo/tutor-contrib-retirement/issues",
"Issue tracker": "https://github.com/hastexo/tutor-contrib-retirement/issues", # noqa: E501
},
license="AGPLv3",
author="hastexo",
Expand Down
2 changes: 2 additions & 0 deletions tests/tutor-sandbox/.placeholder
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory serves as a sandbox for Tutor configurations generated
in the course of automated testing.
25 changes: 25 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[tox]
envlist = py{38,39},flake8

[gh-actions]
python =
3.8: py38,flake8
3.9: py39,flake8

[flake8]
ignore = E124,W504
exclude = .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg,src

[testenv]
setenv =
TUTOR_ROOT = tests/tutor-sandbox
# No "deps" list is necessary here, since setup.py has tutor in its
# install_requires list.
commands =
tutor plugins enable retirement
tutor plugins list

[testenv:flake8]
skip_install = True
deps = flake8
commands = flake8
2 changes: 1 addition & 1 deletion tutorretirement/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# options) by:
# https://packaging.python.org/guides/single-sourcing-package-version/
__version__ = pkg_resources.get_distribution(
'tutor-contrib-webhook-receiver').version
'tutor-contrib-retirement').version
1 change: 0 additions & 1 deletion tutorretirement/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import pkg_resources

from .__about__ import __version__

templates = pkg_resources.resource_filename(
"tutorretirement", "templates"
Expand Down

0 comments on commit 83d0148

Please sign in to comment.