On Thu, 21 Jun 2018 at 07:45, Edmund Szeto <Edmund.Szeto@cypress.com> wrote:

Hi All,

 

I am having a bit of problem running the lava_scheduler_app unit tests as per the instructions at https://validation.linaro.org/static/docs/v2/dispatcher-testing.html.


​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 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/

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...)​



--

Neil Williams
=============
neil.williams@linaro.org
http://www.linux.codehelp.co.uk/