Test fails silently when using --tag

2021-04-04 Thread Cammil Taank
Hi All,

When I run tests using the --tag option, and there is a module level
exception, the tests seem to pass without any errors.

Steps to reproduce:
1. Add this to tests:
from django.test import TestCase
from django.test import tag

assert 0

@tag('abc')
class TempTest(TestCase):

def test_basic(self):
self.assertFalse(True)

2. Run python manage.py test
This should fail as expected

3. Run python manage.py test --tag=abc
This for me passes without any error

Cammil


ontono.com/cammil
taanktech.com
linkedin.com/cammiltaank 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CACc%3DA%3D1gOcps2ameDdo4qkDo64%3DcRB99SrbH%3DxrKx5XeSE%2Bk5Q%40mail.gmail.com.


Re: Test fails silently when using --tag

2021-04-05 Thread Cammil Taank
Thanks for the responses.

Cammil


On Mon, 5 Apr 2021, 14:04 'Adam Johnson' via Django developers
(Contributions to Django itself), 
wrote:

> Great, thanks Tim.
>
> On Mon, 5 Apr 2021 at 13:28, Tim Graham  wrote:
>
>> This was fixed a week ago (will be in Django 4.0).
>> https://code.djangoproject.com/ticket/29127
>>
>> On Monday, April 5, 2021 at 5:18:45 AM UTC-4 Adam Johnson wrote:
>>
>>> Please don't report bugs here but to the ticket tracker. If you're not
>>> sure there's a bug, django-users, the forum, or IRC are the recommended
>>> venues.
>>>
>>> That said, I cannot reproduce your problem. Using django's main branch,
>>> I started a new project with a tests.py file using your exact content and
>>> it errors on import as expected:
>>>
>>> $ ./manage.py test --tag abc
>>> System check identified no issues (0 silenced).
>>> E
>>> ==
>>> ERROR: example.core.tests (unittest.loader._FailedTest)
>>> --
>>> ImportError: Failed to import test module: example.core.tests
>>> Traceback (most recent call last):
>>>   File "/.../python3.9/unittest/loader.py", line 436, in _find_test_path
>>> module = self._get_module_from_name(name)
>>>   File "/.../python3.9/unittest/loader.py", line 377, in
>>> _get_module_from_name
>>> __import__(name)
>>>   File "/.../example/core/tests.py", line 4, in 
>>> assert 0
>>> AssertionError
>>>
>>>
>>> --
>>> Ran 1 test in 0.000s
>>>
>>> FAILED (errors=1)
>>>
>>> On Sun, 4 Apr 2021 at 14:26, Cammil Taank  wrote:
>>>
>>>> Hi All,
>>>>
>>>> When I run tests using the --tag option, and there is a module level
>>>> exception, the tests seem to pass without any errors.
>>>>
>>>> Steps to reproduce:
>>>> 1. Add this to tests:
>>>> from django.test import TestCase
>>>> from django.test import tag
>>>>
>>>> assert 0
>>>>
>>>> @tag('abc')
>>>> class TempTest(TestCase):
>>>>
>>>> def test_basic(self):
>>>> self.assertFalse(True)
>>>>
>>>> 2. Run python manage.py test
>>>> This should fail as expected
>>>>
>>>> 3. Run python manage.py test --tag=abc
>>>> This for me passes without any error
>>>>
>>>> Cammil
>>>>
>>>> 
>>>> ontono.com/cammil
>>>> taanktech.com
>>>> linkedin.com/cammiltaank <https://www.linkedin.com/in/cammiltaank/>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django developers (Contributions to Django itself)" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-develop...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-developers/CACc%3DA%3D1gOcps2ameDdo4qkDo64%3DcRB99SrbH%3DxrKx5XeSE%2Bk5Q%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-developers/CACc%3DA%3D1gOcps2ameDdo4qkDo64%3DcRB99SrbH%3DxrKx5XeSE%2Bk5Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> --
>>> Adam
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/63cd73b5-1099-4bb0-876c-b75370b5bff8n%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-developers/63cd73b5-1099-4bb0-876c-b75370b5bff8n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> Adam
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAMyDDM2m8d2_DpRFYbe%2BR4CCT%2Bkmx0t4xwg3bcBujnktNHy%3Dsw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CAMyDDM2m8d2_DpRFYbe%2BR4CCT%2Bkmx0t4xwg3bcBujnktNHy%3Dsw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CACc%3DA%3D3CCtno4eQ79U%3DBHyUemEfrY7%2Bq-4Yaphpsqg5iURnxWg%40mail.gmail.com.