BTW - I recent;y trid to run Django test suite with Py.test and 
pytest-django plugin and achived some success - main problem, that some 
tests are failing and reason of it is not clear to me yet.
This solution require pytest, django-pytest packages and lightweight 
configuration.
See patch in attachment. I was tested it with Django 1.4.10. Command that I 
used: 
PYTHONPATH=..:$PYTHONPATH py.test


On Monday, February 17, 2014 4:06:33 PM UTC+4, Akshay Jaggi wrote:
>
>
>
> On Saturday, 15 February 2014 20:47:37 UTC+5:30, Chris Wilson wrote:
>>
>> Hi all, 
>>
>> It just occurred to me that most classification systems are completely 
>> arbitrary and therefore not very useful. What's a "system" test and how 
>> would I know whether I need to run it? 
>>
>
> For development purposes we can stick to certain pre-defined and fixed 
> categories. 
> Users may define their own categories according to their own needs and 
> wishes.
>  
>
> But some ideas that I can think of that might be useful are: 
>>
>> * Automatically building test coverage maps for each test, and reversing 
>> them, so we can see which tests touch the line(s) of code that we just 
>> modified, and rerun them easily. A good smoke test to run while modifying 
>> part of Django. 
>>
>
> py.test has a plugin for coverage reporting -> 
> https://bitbucket.org/memedough/pytest-cov/overview.
> Might turn out to be helpful.
>  
>
>>
>> * Categorising by imports: run all tests that import django.db or 
>> django.core.http for example. Not perfect, some tests may touch 
>> facilities 
>> without needing to actually import them, but it would be quick and cheap. 
>>
>>
> This looks like another possible way we can go.
>  
>
>> * Profile and speed up the test suite, so that we can run all tests more 
>> quickly, especially with databases like postgres where it takes an hour 
>> to 
>> run them all. 
>>
>>
> Py.test -> we can parallelise and distribute test loads.
>
>
> --
> Akshay Jaggi
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/d5f33c9e-89f5-4299-acdc-8f1456d04109%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
diff --git a/tests/conftest.py b/tests/conftest.py
new file mode 100644
index 0000000..ed65e84
--- /dev/null
+++ b/tests/conftest.py
@@ -0,0 +1,26 @@
+# coding=utf-8
+from collections import deque
+from genericpath import isdir, exists
+
+__author__ = 'andrew'
+from runtests import setup as django_tests_setup
+from os.path import dirname, split, basename, abspath, normpath
+
+
+def pytest_configure(config):
+    TESTS_PATH = dirname(abspath(__file__))
+
+    modules = deque()
+    for path in config.getoption('file_or_dir'):
+        abs = abspath(path)
+        if not exists(abs) or TESTS_PATH not in abs or TESTS_PATH == abs:
+            continue
+        module_path = path
+        while not isdir(module_path):
+            module_path = dirname(module_path)
+        module_name = basename(normpath(module_path))
+        modules.append(module_name)
+
+    django_tests_setup(0, modules)
+
+
diff --git a/tests/pytest.ini b/tests/pytest.ini
new file mode 100644
index 0000000..6a83477
--- /dev/null
+++ b/tests/pytest.ini
@@ -0,0 +1,3 @@
+[pytest]
+python_files=test*.py
+DJANGO_SETTINGS_MODULE = test_sqlite
\ No newline at end of file

Reply via email to