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

Create a management command to set up a sane pytest configuration #897

Open
IgnisDa opened this issue Dec 18, 2020 · 2 comments
Open

Create a management command to set up a sane pytest configuration #897

IgnisDa opened this issue Dec 18, 2020 · 2 comments

Comments

@IgnisDa
Copy link

IgnisDa commented Dec 18, 2020

I propose we add a management command, maybe something like python manage.py setup_pytest which will create a sane pytest.ini with some default settings. I intend the generated file to look something like this.

The file itself will be generated using the iniconfig package which pytest already depends on. Looks like iniconfig is not capable of writing files, in which case, I will just generate the file using inbuilt strings.

Finally, relevant documentation will also need to be written.

I would make a PR to do all this, when (and if) this is accepted.

@bluetech
Copy link
Member

pytest-django itself is not a Django app, so I'm not sure if we can hook up a custom management command, though it may be possible (I haven't looked too closely).

But in general I think something like this is perhaps better as a cookiecutter template?

@IgnisDa
Copy link
Author

IgnisDa commented Dec 27, 2020

I generally do not recommend cookiecutter since it introduces a dependency for the project. However, we can quickly transform pytest-django to a django app by creating pytest_django/management/commands/setup_pytest.py and then ask users to add pytest_django to their installed apps. Here is a detailed discussion about this topic.

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

2 participants