Skip to content

Document test processes & dependency installation #11

@davidjb

Description

@davidjb

At present, there's no information in the README with regards to what tests should be run for this project and how to setup your environment and run them as a contributor.

Someone who's worked with Python/Django before probably knows to start looking at doing pip install -e . and running python manage.py test but setting that out explicitly would help. But that's not the end of the story -- delving into the project's files, there's https://github.com/microsoft/mssql-django/blob/dev/tox.ini but in order to run tox at all requires setting up your environment with a number of various dependencies and files: https://github.com/microsoft/mssql-django/blob/dev/azure-pipelines.yml (with tox itself, a git clone of Django, SQL Server instance running locally etc).

Having the information detailed and documented in the README would be fantastic to help take the guesswork out of ensuring a PR passes tests locally before committing.

Edit: here's my current process for my own or others' reference:

docker pull mcr.microsoft.com/mssql/server:2019-latest
docker run --name sqlserver -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=MyPassword42' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest

cd path/to/mssql-django
python3 -m venv .
source ./bin/activate
pip install -e
pip install django==3.1.8
# See https://github.com/microsoft/mssql-django/issues/10
sed -i 's/"ODBC Driver 17 for SQL Server"/"FreeTDS", "host_is_server": True/g' testapp/settings.py 
python manage.py test

docker rm -f sqlserver 
# or stop with `docker stop sqlserver` and leave it there for next time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions