[Python-modules-commits] [python-django-treebeard] 01/17: Remove unneeded pytest idmaker hack. Using a supportd ids=arg instead.

Michael Fladischer fladi at moszumanska.debian.org
Sat Jan 2 18:39:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository python-django-treebeard.

commit 191fc59ae83f170acc32756ad05c4d30e159938d
Author: Michael Fladischer <fladi at debian.org>
Date:   Wed Dec 30 19:37:25 2015 +0100

    Remove unneeded pytest idmaker hack. Using a supportd ids=arg instead.
    
    Origin: https://github.com/tabo/django-treebeard/commit/4228f3e118c2bc85666edf11708404d7a830d1c0
    Last-Update: 2015-09-08
---
 treebeard/tests/conftest.py       | 19 -------------------
 treebeard/tests/test_treebeard.py | 24 ++++++++++++++----------
 2 files changed, 14 insertions(+), 29 deletions(-)

diff --git a/treebeard/tests/conftest.py b/treebeard/tests/conftest.py
index 073a9cc..d6f2876 100644
--- a/treebeard/tests/conftest.py
+++ b/treebeard/tests/conftest.py
@@ -13,25 +13,6 @@ from django.test.client import Client
 from django.core.management import call_command
 from django.core import mail
 from django.db import connection
-from django.db.models.base import ModelBase
-from _pytest import python as _pytest_python
-
-
-def idmaker(argnames, argvalues):
-    idlist = []
-    for valindex, valset in enumerate(argvalues):
-        this_id = []
-        for nameindex, val in enumerate(valset):
-            argname = argnames[nameindex]
-            if isinstance(val, (float, int, str)):
-                this_id.append(str(val))
-            elif isinstance(val, ModelBase):
-                this_id.append(val.__name__)
-            else:
-                this_id.append("{0}-{1}={2!s}".format(argname, valindex))
-        idlist.append("][".join(this_id))
-    return idlist
-_pytest_python.idmaker = idmaker
 
 
 def pytest_report_header(config):
diff --git a/treebeard/tests/test_treebeard.py b/treebeard/tests/test_treebeard.py
index e0bf0d9..7f65239 100644
--- a/treebeard/tests/test_treebeard.py
+++ b/treebeard/tests/test_treebeard.py
@@ -62,53 +62,57 @@ def _prepare_db_test(request):
     return request.param
 
 
+def idfn(fixture_value):
+    return fixture_value.__name__
+
 @pytest.fixture(scope='function',
-                params=models.BASE_MODELS + models.PROXY_MODELS)
+                params=models.BASE_MODELS + models.PROXY_MODELS,
+                ids=idfn)
 def model(request):
     return _prepare_db_test(request)
 
 
- at pytest.fixture(scope='function', params=models.BASE_MODELS)
+ at pytest.fixture(scope='function', params=models.BASE_MODELS, ids=idfn)
 def model_without_proxy(request):
     return _prepare_db_test(request)
 
 
- at pytest.fixture(scope='function', params=models.UNICODE_MODELS)
+ at pytest.fixture(scope='function', params=models.UNICODE_MODELS, ids=idfn)
 def model_with_unicode(request):
     return _prepare_db_test(request)
 
 
- at pytest.fixture(scope='function', params=models.SORTED_MODELS)
+ at pytest.fixture(scope='function', params=models.SORTED_MODELS, ids=idfn)
 def sorted_model(request):
     return _prepare_db_test(request)
 
 
- at pytest.fixture(scope='function', params=models.RELATED_MODELS)
+ at pytest.fixture(scope='function', params=models.RELATED_MODELS, ids=idfn)
 def related_model(request):
     return _prepare_db_test(request)
 
 
- at pytest.fixture(scope='function', params=models.INHERITED_MODELS)
+ at pytest.fixture(scope='function', params=models.INHERITED_MODELS, ids=idfn)
 def inherited_model(request):
     return _prepare_db_test(request)
 
 
- at pytest.fixture(scope='function', params=models.MP_SHORTPATH_MODELS)
+ at pytest.fixture(scope='function', params=models.MP_SHORTPATH_MODELS, ids=idfn)
 def mpshort_model(request):
     return _prepare_db_test(request)
 
 
- at pytest.fixture(scope='function', params=[models.MP_TestNodeShortPath])
+ at pytest.fixture(scope='function', params=[models.MP_TestNodeShortPath], ids=idfn)
 def mpshortnotsorted_model(request):
     return _prepare_db_test(request)
 
 
- at pytest.fixture(scope='function', params=[models.MP_TestNodeAlphabet])
+ at pytest.fixture(scope='function', params=[models.MP_TestNodeAlphabet], ids=idfn)
 def mpalphabet_model(request):
     return _prepare_db_test(request)
 
 
- at pytest.fixture(scope='function', params=[models.MP_TestNodeSortedAutoNow])
+ at pytest.fixture(scope='function', params=[models.MP_TestNodeSortedAutoNow], ids=idfn)
 def mpsortedautonow_model(request):
     return _prepare_db_test(request)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django-treebeard.git



More information about the Python-modules-commits mailing list