Unable to get tests to work

56 views
Skip to first unread message

Matt

unread,
Aug 17, 2016, 4:17:37 PM8/17/16
to Django users
When I'm trying to get tests to work it simply states that its unable to import <app>.tests. I'm not sure what I'm missing here. Here is some output please let me know if you need more:

./manage.py tests backups

The test file:

Fred Stluka

unread,
Aug 17, 2016, 4:24:19 PM8/17/16
to django...@googlegroups.com
Matt,

Drop the "s" from "tests":

./manage.py test backups

--Fred

Fred Stluka -- mailto:fr...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/89d6fac7-0848-4e35-8b4a-62d24178c3aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Matt

unread,
Aug 17, 2016, 4:27:59 PM8/17/16
to Django users
Sorry for the typo, but I have already do that way. I have the output in the the first link.


On Wednesday, August 17, 2016 at 2:24:19 PM UTC-6, Fred Stluka wrote:
Matt,

Drop the "s" from "tests":

./manage.py test backups

Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

Fred Stluka

unread,
Aug 17, 2016, 4:34:45 PM8/17/16
to django...@googlegroups.com
Matt,

Oops!  Right.  I just noticed that in the dpaste.

My next guess is you may need to change the name "good_index_text"
to something that starts with "test_" to get it to be recognized as a
test.

Or maybe something to do with "refreshes"?  The test trace shows
it trying to run testcase "refreshes.backups.tests", but in the manual
import you did from the python shell, you only import "backups.tests"

Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

Matt

unread,
Aug 17, 2016, 5:03:30 PM8/17/16
to Django users
Ok a step forward. When I spell out the tests it works: 


But when I run test without arguments, it fails out:


There is more than the backups app here, but I plan to replicate out the fix when I get it.

On Wednesday, August 17, 2016 at 2:34:45 PM UTC-6, Fred Stluka wrote:
Matt,

Oops!  Right.  I just noticed that in the dpaste.

My next guess is you may need to change the name "good_index_text"
to something that starts with "test_" to get it to be recognized as a
test.

Or maybe something to do with "refreshes"?  The test trace shows
it trying to run testcase "refreshes.backups.tests", but in the manual
import you did from the python shell, you only import "backups.tests"

--Fred

Gergely Polonkai

unread,
Aug 18, 2016, 1:16:27 AM8/18/16
to Django users

Hello,

this “refreshes.backups.tests” thing bothers me a lot. Could you show us your directory structure, please?

Best,
Gergely


Matt

unread,
Aug 18, 2016, 11:50:47 AM8/18/16
to Django users

Matt

unread,
Aug 18, 2016, 3:49:26 PM8/18/16
to Django users
Sorry replied to the wrong thread: https://dpaste.de/OF8j


On Wednesday, August 17, 2016 at 11:16:27 PM UTC-6, Gergely Polonkai wrote:

Fred Stluka

unread,
Aug 19, 2016, 12:37:51 PM8/19/16
to django...@googlegroups.com
Matt,

At a glance, the directory structure looks OK.  Seems odd though
that you have some *.pyc files with no corresponding *.py file.
For example, frontend/tests.pyc and nas/tests.pyc.  Could such
a file be tripping up the test runner?  That might explain why it
fails when no arguments -- searching for all tests and getting
confused -- but succeeds when told to run only backups.tests.

Same for all of the erp/*.pyc files.

Perhaps try deleting all *.pyc file in the entire tree and then run
the tests, letting them be recreated from the *.py files as needed.

Also, I see a backup/tests.py with no *.pyc file.  Is there a syntax
error in that file that makes it not compile?  Or is it just not
getting that far?

Also, what is in pytest.ini?  Is it perhaps directing the test runner
to look for tests that don't exist?

--Fred
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.

Matt

unread,
Aug 19, 2016, 1:35:04 PM8/19/16
to Django users
I purged all the '*.pyc' and the result remains the same. The missing pyc files could be explained by that I use Pycharm to dev in. It appears that this IDE cleans those up automatically. Also I have been dropping to a shell trying to test things to resolve the issue, which would explain why there are some pyc files but not all.

pytest was an attempt to resolve the issue outside of django's manage.py. It failed as well. Here is the pytest.ini:

    [pytest]
    DJANGO_SETTINGS_MODULE=refreshes.settings

Thanks,
Matt

On Friday, August 19, 2016 at 10:37:51 AM UTC-6, Fred Stluka wrote:
Matt,

At a glance, the directory structure looks OK.  Seems odd though
that you have some *.pyc files with no corresponding *.py file.
For example, frontend/tests.pyc and nas/tests.pyc.  Could such
a file be tripping up the test runner?  That might explain why it
fails when no arguments -- searching for all tests and getting
confused -- but succeeds when told to run only backups.tests.

Same for all of the erp/*.pyc files.

Perhaps try deleting all *.pyc file in the entire tree and then run
the tests, letting them be recreated from the *.py files as needed.

Also, I see a backup/tests.py with no *.pyc file.  Is there a syntax
error in that file that makes it not compile?  Or is it just not
getting that far?

Also, what is in pytest.ini?  Is it perhaps directing the test runner
to look for tests that don't exist?

--Fred
Reply all
Reply to author
Forward
0 new messages