(Grrr.. used the wrong keyboard shortcut and email got sent too soon)
So I searched for "TypeError: unhashable type" in the mailing list archive and found that a solution was to install the python3-django-testscenarios package from stretch-backports. I did that and now I can run the unit tests!
Thanks for the help!
Cheers,
Edmund
_____________________________________________
From: Edmund Szeto
Sent: Friday, June 22, 2018 11:36 AM
To: 'Neil Williams' <neil.williams@linaro.org>
Cc: Lava Users Mailman list <lava-users@lists.linaro.org>
Subject: RE: [Lava-users] Running unit tests
Hi Neil,
Hi All,
That one section needs updating - ./ci-run no longer takes a test name argument.
Use:
$ ./lava_server/manage.py test -v2 lava_scheduler_app.tests.test_device.DeviceTypeTest.test_unknown_invalid_template
This unit test, test_device,py, uses Database objects, so needs to run with manage.py
Other template unit tests (the ones including template in the filename like test_uboot_templates.py) can be run without needing a database to be created:
$ python3 -m unittest -vcf lava_scheduler_app.tests.test_uboot_templates..TestUbootTemplates.test_panda_template
To run all of the lava-server unit tests, use:
$ ./ci-run -s
To run all of the lava-dispatcher unit tests, use:
$ ./ci-run -d
To run all the template tests which don't need a database to be created:
$ ./ci-run -t
I tried those commands (without the sudo) and I still got the same " TypeError: unhashable type: …" exceptions.
I keep getting errors such as the following:
$ sudo ./ci-run
lava_scheduler_app.tests.test_device.TestTemplates.test_x86_template
*Don't use sudo* - the documentation does not use sudo.
This will *really* mess with your git working directory. Unit tests are *local* and no permission privileges are required.
Unfortunately, because you've used sudo, you will now have to fix up lots of permissions in that directory to get things working again.
I'll have a look at making ./ci-run fail under sudo (whilst preserving use as root for use in an LXC etc.)
sudo is *only* required to use the system paths: $ sudo lava-server manage # uses /usr/lib/python3/dist-packages/
I tried without sudo at first and somehow the unit tests tried using /etc/lava-server/instance.conf and /etc/lava-server/settings.conf, so I tried again with sudo. It must've been a side effect of me running
the installed "lava-server manage test" command inside my local lava workspace. I've fixed this by doing a "git clean -xdf".
Note the change in syntax.
+ set -e+ getopts :pdty opt
+ shift 0
+ pep8 --ignore E501,E722 .
+ '[' -n '' ']'
+ echo 'Removing old .pyc files and cache'
Removing old .pyc files and cache
+ echo
+ find . -name '*.pyc' -delete
+ rm -rf ./.cache/
+ rm -rf ./__init__.py
+ echo 'Starting unit tests'
Starting unit tests
+ echo
+ '[' -z '' -a -z '' -a -z '' ']'
+ echo 'If it exists, a broken test database will be deleted without prompting.'
If it exists, a broken test database will be deleted without prompting.
+ python3 ./lava_server/manage.py test --noinput -v 2 lava_scheduler_app linaro_django_xmlrpc.tests lava_results_app
Traceback (most recent call last):
File "./lava_server/manage.py", line 78, in <module>
main()
File "./lava_server/manage.py", line 74, in main
execute_from_command_line(django_options)
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3/dist-packages/django/core/management/commands/test.py", line 29, in run_from_argv
super(Command, self).run_from_argv(argv)
File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/usr/lib/python3/dist-packages/django/core/management/commands/test.py", line 62, in handle
failures = test_runner.run_tests(test_labels)
File "/usr/lib/python3/dist-packages/django/test/runner.py", line 600, in run_tests
suite = self.build_suite(test_labels, extra_tests)
File "/usr/lib/python3/dist-packages/django/test/runner.py", line 526, in build_suite
suite = reorder_suite(suite, self.reorder_by, self.reverse)
File "/usr/lib/python3/dist-packages/django/test/runner.py", line 640, in reorder_suite
partition_suite_by_type(suite, classes, bins, reverse=reverse)
File "/usr/lib/python3/dist-packages/django/test/runner.py", line 663, in partition_suite_by_type
partition_suite_by_type(test, classes, bins, reverse=reverse)
File "/usr/lib/python3/dist-packages/django/test/runner.py", line 663, in partition_suite_by_type
partition_suite_by_type(test, classes, bins, reverse=reverse)
File "/usr/lib/python3/dist-packages/django/test/runner.py", line 667, in partition_suite_by_type
bins[i].add(test)
File "/usr/lib/python3/dist-packages/django/utils/datastructures.py", line 17, in add
self.dict[item] = None
TypeError: unhashable type: 'TestSchedulerAPI'
I have backed out all my changes and I still get the TypeErrors. I tried the latest in the master branch, and also the 2018.5 release tag. Could someone please let me know
what I am doing incorrectly? Thanks!
Cheers,
Edmund
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.
(May be worth checking with Cypress about disclaimers on email going to publicly archived mailing lists...)
IT policy. Hard to fight it.
--
Thanks,
Edmund
This message and any attachments may contain confidential information from Cypress or its subsidiaries. If it has been received in error, please advise the sender and immediately delete this message.