Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .
- ├── __init__.py
- ├── manage.py
- ├── mydjango
- │ ├── __init__.py
- │ ├── __init__.pyc
- │ ├── mydjango.nja
- │ ├── settings.py
- │ ├── settings.pyc
- │ ├── templates
- │ │ └── admin
- │ │ └── base_site.html
- │ ├── urls.py
- │ ├── urls.pyc
- │ ├── wsgi.py
- │ └── wsgi.pyc
- ├── polls
- │ ├── admin.py
- │ ├── admin.pyc
- │ ├── __init__.py
- │ ├── __init__.pyc
- │ ├── models.py
- │ ├── models.pyc
- │ ├── templates
- │ │ ├── __init__.py
- │ │ └── polls
- │ │ ├── detail.html
- │ │ ├── index.html
- │ │ ├── __init__.py
- │ │ └── results.html
- │ ├── tests.py
- │ ├── tests.pyc
- │ ├── urls.py
- │ ├── urls.pyc
- │ ├── views.py
- │ └── views.pyc
- └── polls.nja
- # -*- coding: utf-8 -*-
- from django.test import TestCase
- import datetime
- from django.utils import timezone
- from polls.models import Question
- # Create your tests here.l
- class QuestionMethodTests(TestCase):
- def test_was_published_recently_with_future_poll(self):
- """
- was_published_recently dovrebbe ritornare falso se si mette una data nel futuro
- """
- future_question = Question(pub_date=timezone.now() + datetime.timedelta(hours=50))
- self.assertEqual(future_question.was_published_recently(), False)
- $pip install unittest2
- $python manage.py test polls
- Creating test database for alias 'default'...
- E
- ======================================================================
- ERROR: mydjango.polls.tests (unittest2.loader.ModuleImportFailure)
- ----------------------------------------------------------------------
- ImportError: Failed to import test module: mydjango.polls.tests
- Traceback (most recent call last):
- File "/home/sergio/.virtualenvs/django4/local/lib/python2.7/site-packages/unittest2/loader.py", line 260, in _find_tests
- module = self._get_module_from_name(name)
- File "/home/sergio/.virtualenvs/django4/local/lib/python2.7/site-packages/unittest2/loader.py", line 238, in _get_module_from_name
- __import__(name)
- ImportError: No module named polls.tests
- ----------------------------------------------------------------------
- Ran 1 test in 0.001s
- FAILED (errors=1)
- Destroying test database for alias 'default'...
- $ python manage.py test
- Creating test database for alias 'default'...
- E
- ======================================================================
- ERROR: mydjango.polls.tests (unittest2.loader.ModuleImportFailure)
- ----------------------------------------------------------------------
- ImportError: Failed to import test module: mydjango.polls.tests
- Traceback (most recent call last):
- File "/home/sergio/.virtualenvs/django4/local/lib/python2.7/site-packages/unittest2/loader.py", line 260, in _find_tests
- module = self._get_module_from_name(name)
- File "/home/sergio/.virtualenvs/django4/local/lib/python2.7/site-packages/unittest2/loader.py", line 238, in _get_module_from_name
- __import__(name)
- ImportError: No module named polls.tests
- ----------------------------------------------------------------------
- Ran 1 test in 0.001s
- FAILED (errors=1)
- Destroying test database for alias 'default'...
- INSTALLED_APPS = (
- 'south',
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'polls',
- )
- $ python manage test polls.tests
- $ python manage test polls
- $ python manage test
- (...)
- ImportError: Failed to import test module: mydjango.polls.tests
- Traceback (most recent call last):
- (...)
- ImportError: No module named polls.tests
- $ rm mydjango/__init__.py
- python ../manage.py test polls
- $ python manage.py test polls.tests
- Creating test database for alias 'default'...
- F
- ======================================================================
- FAIL: test_was_published_recently_with_future_poll (polls.tests.QuestionMethodTests)
- ----------------------------------------------------------------------
- Traceback (most recent call last):
- File "/home/sergio/.virtualenvs/django4/mydjango/polls/tests.py", line 17, in test_was_published_recently_with_future_poll
- self.assertEqual(future_question.was_published_recently(), False)
- AssertionError: True != False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement