This is phenomenally strange for me, things were working PERFECTLY fine until this morning.
When I attempt to run my unit test using the following (I have Python3 soft linked to python)
clear; python manage.py test list tests/
I now get the following error message:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python3.4/site-packages/django/core/management /__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/lib/python3.4/site-packages/django/core/management /__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3.4/site-packages/django/core/management/commands /test.py", line 50, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/usr/lib/python3.4/site-packages/django/core/management /base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib/python3.4/site-packages/django/core/management/commands /test.py", line 71, in execute
super(Command, self).execute(*args, **options)
File "/usr/lib/python3.4/site-packages/django/core/management /base.py", line 338, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3.4/site-packages/django/core/management/commands /test.py", line 88, in handle
failures = test_runner.run_tests(test_labels)
File "/usr/lib/python3.4/site-packages/django/test/runner.py", line 146, in run_tests
suite = self.build_suite(test_labels, extra_tests)
File "/usr/lib/python3.4/site-packages/django/test/runner.py", line 101, in build_suite
suite.addTests(tests)
File "/usr/lib64/python3.4/unittest/suite.py", line 60, in addTests
for test in tests:
TypeError: 'NoneType' object is not iterable
I initially thought that I wrote something that completely messed everything up, so I saved this as a branch, reverted back in the master branch to a commit that I am CERTAIN works but I get the exact same error message.
I can't think of anything I did to make things fail like this, in fact, the above doesn't point to anything I've written which (in my case, I'm relatively new to Python/Django) is making it difficult for me to debug the error.
The ONLY thing I can think of that changed is my installation of The Silver Searcher (I use vim) which I removed and still the same error happens.
I've reinstalled django, but still to no avail.
This is on:
Can someone help me out in
Thank you
The TypeError: 'NoneType' object is not iterable error is raised when you try to iterate over an object whose value is equal to None. To solve this error, make sure that any values that you try to iterate over have been assigned an iterable object, like a string or a list.
The Python "TypeError: argument of type 'NoneType' is not iterable" occurs when we use the membership test operators (in and not in) with a None value. To solve the error, correct the assignment of the variable that stores None or check if it doesn't store None .
The Python "TypeError: 'NoneType' object is not iterable" occurs when we try to iterate over a None value. To solve the error, figure out where the variable got assigned a None value and correct the assignment or check if the variable doesn't store None before iterating.
Just had this error, caused by an issue I had solved months ago and accidentally happened upon briefly again.
The problem is that when you specify the directory for django test you should use python notation for the directory, not standard shell notation. For example
Correct - project.tests.test_module
Incorrect - project/tests/test_module.py
I wasn't able to explain WHY this is so, but when I ran the "python manage.py test list/" without specifying the file name, things worked perfectly well.
Thanks to user Ella Shar, I will be changing the scheme/layout I set my tests to the approved dotted format as described in the documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With