Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidy Tox and testing environment #147

Merged
merged 2 commits into from Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGES.rst
Expand Up @@ -2,7 +2,8 @@ Changelog
=========
2.0.1 (in development)
----------------------
TBD
* Cleaned Tox test environment.
* Removed Django 2.0 from test matrix as no longer supported.

2.0.0
-----
Expand Down Expand Up @@ -244,7 +245,7 @@ TBD
* Correct escaping of *for* attribute in label for the sortedm2m widget. Thanks
to Mystic-Mirage for the report and fix.

0.6.0
0.6.0
-----

* Python 3 support!
Expand Down
7 changes: 1 addition & 6 deletions Makefile
@@ -1,4 +1,4 @@
.PHONY: quality requirements test-postgres
.PHONY: quality requirements

quality: ## Run isort, pycodestyle, and Pylint
isort --check-only --recursive sortedm2m/
Expand All @@ -7,8 +7,3 @@ quality: ## Run isort, pycodestyle, and Pylint

requirements: ## Install requirements for development
pip install -r requirements/test.txt

test-postgres:
vagrant up
vagrant ssh -c "cd /vagrant ; DJANGO_SETTINGS_MODULE=test_project.postgres_settings python runtests.py"

14 changes: 3 additions & 11 deletions README.rst
Expand Up @@ -192,15 +192,7 @@ the root directory of the ``django-sortedm2m`` checkout::

tox

However using tox will not include the tests that run against a PostgreSQL
database. The project therefore contains a ``Vagrantfile`` that uses vagrant_
to setup a virtual machine including a working PostgreSQL installation. To
run the postgres tests, please `install vagrant`_ and then run::
The tests are run against SQLite, then against PostgreSQL, then against mySQL -
so you need to install PostgreSQL and mySQL on your dev environment, and should
have a role/user ``sortedm2m`` set up for both PostgreSQL and mySQL.

make test-postgres

This will bring up and provision the virtual machine and runs the testsuite
against a PostgreSQL database.

.. _vagrant: http://www.vagrantup.com/
.. _install vagrant: http://www.vagrantup.com/downloads
142 changes: 0 additions & 142 deletions Vagrantfile

This file was deleted.

21 changes: 2 additions & 19 deletions tox.ini
Expand Up @@ -2,7 +2,7 @@
minversion = 1.8
envlist =
py27-{111},
py{35,36,37}-{111,20,21,22}
py{35,36,37}-{111,21,22}

[testenv]
deps =
Expand All @@ -11,7 +11,6 @@ deps =
py{35,36,37}: mysqlclient
psycopg2-binary
111: Django>=1.11,<2.0
20: Django>=2.0,<2.1
21: Django>=2.1,<2.2
22: Django>=2.2,<3.0
setenv =
Expand All @@ -20,6 +19,7 @@ passenv =
DJANGO_DB_USER
DJANGO_DB_PASSWORD
commands =
# Test against SQLite3, then PostgreSQL, then mySQL.
python -Wd {envbindir}/django-admin.py test --settings=settings --noinput {posargs:sortedm2m_tests}
python -Wd {envbindir}/django-admin.py test --settings=postgres_settings --noinput {posargs:sortedm2m_tests}
python -Wd {envbindir}/django-admin.py test --settings=mysql_settings --noinput {posargs:sortedm2m_tests}
Expand All @@ -41,20 +41,3 @@ commands =
coverage run runtests.py
make quality

[testenv:vagrant-postgres]
# A test environment utilizing a virtual machine for easy testing with
# postgresql databases. To run tests using this environment, execute:
#
# tox -e vagrant-postgres
commands =
vagrant up
vagrant ssh -c "cd /vagrant && DJANGO_SETTINGS_MODULE=test_project.postgres_settings python runtests.py"

[testenv:vagrant-mysql]
# A test environment utilizing a virtual machine for easy testing with
# mysql databases. To run tests using this environment, execute:
#
# tox -e vagrant-mysql
commands =
vagrant up
vagrant ssh -c "cd /vagrant && DJANGO_SETTINGS_MODULE=test_project.mysql_settings python runtests.py"