Repository: imAsparky/django-cookiecutter

Issue:
[FEAT]: Improve Django Project tox.ini coverage and performance.
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

From James Bennett.  Makes perfect sense.
https://www.b-list.org/weblog/2020/feb/03/how-im-testing-2020/

**Additional context**
Add any other context or screenshots about the feature request here.



Discussion:

Resolving patch:
diff --git a/{{cookiecutter.git_project_name}}/users/models.py b/{{cookiecutter.git_project_name}}/users/models.py
--- a/{{cookiecutter.git_project_name}}/users/models.py
+++ b/{{cookiecutter.git_project_name}}/users/models.py
@@ -10,7 +10,10 @@
 class CustomUserManager(BaseUserManager):
     """Custom user manager."""
 
-    def create_user(self, email=None, password=None, **extra_fields):
+    def create_user(
+        self, email=None, password=None, **extra_fields
+    ):  # pragma: no cover
+        """Create and save a User."""
         """Create and save a User."""
         if not email:
             raise ValueError(_("An email address must be supplied."))
@@ -22,7 +25,10 @@ def create_user(self, email=None, password=None, **extra_fields):
         user.save()
         return user
 
-    def create_superuser(self, email=None, password=None, **extra_fields):
+    def create_superuser(
+        self, email=None, password=None, **extra_fields
+    ):  # pragma: no cover
+        """Create and save a User."""
         """Create and save a SuperUser."""
         extra_fields.setdefault("is_staff", True)
         extra_fields.setdefault("is_superuser", True)


Test patch:
diff --git a/tests/test_bake_django.py b/tests/test_bake_django.py
--- a/tests/test_bake_django.py
+++ b/tests/test_bake_django.py
@@ -833,6 +833,20 @@ def test_baked_django_settings_test_file_ok(cookies):
     assert 'ALLOWED_HOSTS = [""]' in settings_file
 
 
+def test_baked_django_tox_file_ok(cookies):
+    """Test Django tox.ini file has been generated correctly."""
+    default_django = cookies.bake()
+
+    tox_path = default_django.project_path / "tox.ini"
+    tox_file = str(tox_path.read_text().splitlines())
+
+    assert (
+        '  find {toxinidir}/django_boilerplate -type f -name "*.pyc" -delete'
+        in tox_file
+    )
+    assert 'mypy --ignore-missing-imports {toxinidir}/django_boilerplate' in tox_file
+
+
 def test_baked_django_urls_file_ok(cookies):
     """Test Django urls.py file has generated correctly."""
     default_django = cookies.bake()
diff --git a/{{cookiecutter.git_project_name}}/config/requirements/test.txt b/{{cookiecutter.git_project_name}}/config/requirements/test.txt
--- a/{{cookiecutter.git_project_name}}/config/requirements/test.txt
+++ b/{{cookiecutter.git_project_name}}/config/requirements/test.txt
@@ -1,5 +1,7 @@
+coverage==6.2
 dj-inmemorystorage==2.1.0
-psycopg2==2.9.3
+psycopg2==2.9.3 # This version should be used in production
+#psycopg2-binary  # This version is ok for Development and Testing
 pytest==6.2.5
 pytest-django==4.5.2
 pytest-reverse==1.3.0