Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. .
  2. ├── __init__.py
  3. ├── manage.py
  4. ├── mydjango
  5. │   ├── __init__.py
  6. │   ├── __init__.pyc
  7. │   ├── mydjango.nja
  8. │   ├── settings.py
  9. │   ├── settings.pyc
  10. │   ├── templates
  11. │   │   └── admin
  12. │   │   └── base_site.html
  13. │   ├── urls.py
  14. │   ├── urls.pyc
  15. │   ├── wsgi.py
  16. │   └── wsgi.pyc
  17. ├── polls
  18. │   ├── admin.py
  19. │   ├── admin.pyc
  20. │   ├── __init__.py
  21. │   ├── __init__.pyc
  22. │   ├── models.py
  23. │   ├── models.pyc
  24. │   ├── templates
  25. │   │   ├── __init__.py
  26. │   │   └── polls
  27. │   │   ├── detail.html
  28. │   │   ├── index.html
  29. │   │   ├── __init__.py
  30. │   │   └── results.html
  31. │   ├── tests.py
  32. │   ├── tests.pyc
  33. │   ├── urls.py
  34. │   ├── urls.pyc
  35. │   ├── views.py
  36. │   └── views.pyc
  37. └── polls.nja
  38.  
  39. # -*- coding: utf-8 -*-
  40. from django.test import TestCase
  41. import datetime
  42. from django.utils import timezone
  43. from polls.models import Question
  44.  
  45. # Create your tests here.l
  46. class QuestionMethodTests(TestCase):
  47.  
  48. def test_was_published_recently_with_future_poll(self):
  49. """
  50. was_published_recently dovrebbe ritornare falso se si mette una data nel futuro
  51. """
  52. future_question = Question(pub_date=timezone.now() + datetime.timedelta(hours=50))
  53. self.assertEqual(future_question.was_published_recently(), False)
  54.  
  55. $pip install unittest2
  56.  
  57. $python manage.py test polls
  58. Creating test database for alias 'default'...
  59. E
  60. ======================================================================
  61. ERROR: mydjango.polls.tests (unittest2.loader.ModuleImportFailure)
  62. ----------------------------------------------------------------------
  63. ImportError: Failed to import test module: mydjango.polls.tests
  64. Traceback (most recent call last):
  65. File "/home/sergio/.virtualenvs/django4/local/lib/python2.7/site-packages/unittest2/loader.py", line 260, in _find_tests
  66. module = self._get_module_from_name(name)
  67. File "/home/sergio/.virtualenvs/django4/local/lib/python2.7/site-packages/unittest2/loader.py", line 238, in _get_module_from_name
  68. __import__(name)
  69. ImportError: No module named polls.tests
  70.  
  71.  
  72. ----------------------------------------------------------------------
  73. Ran 1 test in 0.001s
  74.  
  75. FAILED (errors=1)
  76. Destroying test database for alias 'default'...
  77.  
  78. $ python manage.py test
  79. Creating test database for alias 'default'...
  80. E
  81. ======================================================================
  82. ERROR: mydjango.polls.tests (unittest2.loader.ModuleImportFailure)
  83. ----------------------------------------------------------------------
  84. ImportError: Failed to import test module: mydjango.polls.tests
  85. Traceback (most recent call last):
  86. File "/home/sergio/.virtualenvs/django4/local/lib/python2.7/site-packages/unittest2/loader.py", line 260, in _find_tests
  87. module = self._get_module_from_name(name)
  88. File "/home/sergio/.virtualenvs/django4/local/lib/python2.7/site-packages/unittest2/loader.py", line 238, in _get_module_from_name
  89. __import__(name)
  90. ImportError: No module named polls.tests
  91.  
  92.  
  93. ----------------------------------------------------------------------
  94. Ran 1 test in 0.001s
  95.  
  96. FAILED (errors=1)
  97. Destroying test database for alias 'default'...
  98.  
  99. INSTALLED_APPS = (
  100. 'south',
  101. 'django.contrib.admin',
  102. 'django.contrib.auth',
  103. 'django.contrib.contenttypes',
  104. 'django.contrib.sessions',
  105. 'django.contrib.messages',
  106. 'django.contrib.staticfiles',
  107. 'polls',
  108. )
  109.  
  110. $ python manage test polls.tests
  111.  
  112. $ python manage test polls
  113. $ python manage test
  114. (...)
  115. ImportError: Failed to import test module: mydjango.polls.tests
  116. Traceback (most recent call last):
  117. (...)
  118. ImportError: No module named polls.tests
  119.  
  120. $ rm mydjango/__init__.py
  121.  
  122. python ../manage.py test polls
  123.  
  124. $ python manage.py test polls.tests
  125.  
  126. Creating test database for alias 'default'...
  127. F
  128. ======================================================================
  129. FAIL: test_was_published_recently_with_future_poll (polls.tests.QuestionMethodTests)
  130. ----------------------------------------------------------------------
  131. Traceback (most recent call last):
  132. File "/home/sergio/.virtualenvs/django4/mydjango/polls/tests.py", line 17, in test_was_published_recently_with_future_poll
  133. self.assertEqual(future_question.was_published_recently(), False)
  134. AssertionError: True != False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement