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

Ability to run flexibly run tests on different database drivers/backends #10

Open
davidjb opened this issue Mar 3, 2021 · 5 comments
Open

Comments

@davidjb
Copy link
Contributor

davidjb commented Mar 3, 2021

The original version of django-mssql-backend utilised dj_database_url in order to provide a flexible way of specifying the database configuration when running tests, by way of environment variables (https://github.com/ESSolutions/django-mssql-backend/blob/master/testapp/settings.py#L1-L6). With this fork, that flexibility has been replaced with hard-coded settings in https://github.com/microsoft/mssql-django/blob/dev/testapp/settings.py, forcing one to edit that file to change the user/password/host/port/driver settings.

As a Mac/Linux user I'm using Docker and FreeTDS as the simplest/most convenient way in which to run up and connect to a test SQL Server on my OS (I recall there being issues installing the Microsoft ODBC driver) and do so on a custom port in order to be able to run tests for this project. The original setup in django-mssql-backend means that this was possible:

export DATABASE_URL='mssql://user:password@localhost:9999?engine=FreeTDS&host_is_server=True'
python manage.py test

whereas now in order to submit and test #9 I had to manually edit settings.py and be careful not to commit that change.

Is this or some level of flexibility for test execution able to be reinstated?

@vwarchu
Copy link
Contributor

vwarchu commented Mar 4, 2021

Hi @davidjb, I think the case is strong to reinstate this. We'll review internally and confirm back - thanks

@XF-FW
Copy link

XF-FW commented Nov 16, 2022

dj-database-url supports this database engine as of the latest version, so I think it's safe for this issue to be closed, IMO.

@davidjb
Copy link
Contributor Author

davidjb commented Nov 16, 2022

@XF-FW This issue is that mssql-django's testapp doesn't allow for customisation of its databases and settings, rather being related to dj_database_url operates.

If you compare the current version to the ESSSolutions version, you'll see what I mean - the current version has all of its settings hardcoded so if someone wanted to change the OPTIONS (as I needed to), they have to manually edit settings.py (or otherwise monkey patch the changes in somehow).

@XF-FW
Copy link

XF-FW commented Nov 17, 2022

Ah, yeah, that makes sense. Ignore my comment then. Sorry about that.

@davidjb
Copy link
Contributor Author

davidjb commented Nov 17, 2022

No worries @XF-FW! It's good to know it's got support for SQL Server now, so perhaps just using dj-database-url again would be the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants