← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1873532] Re: pytest breaks all horizon plugin tests

 

Reviewed:  https://review.opendev.org/720844
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=0c96dcf293be221847f30d8e1d7a0df9d0167b92
Submitter: Zuul
Branch:    master

commit 0c96dcf293be221847f30d8e1d7a0df9d0167b92
Author: Akihiro Motoki <amotoki@xxxxxxxxx>
Date:   Sat Apr 18 08:38:36 2020 +0900

    Handle case without pytest for plugin tests
    
    Switching the test runner to pytest in horizon assumes pytest is always
    installed, but horizon test helpers are used in horizon plugin tests and
    pytest is not used in horizon plugin tests. As a result, all horizon plugin
    tests are now broken.
    
    This commit considers a case where pytest does not exist.
    A wrapper decorator for pytest.mark.xxxx is introduced and
    it acts as a null decorator if pytest is not installed.
    
    Change-Id: I80736b108f5ae9a36c0e756bf386468879be3293
    Closes-Bug: #1873532


** Changed in: horizon
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1873532

Title:
  pytest breaks all horizon plugin tests

Status in OpenStack Dashboard (Horizon):
  Fix Released

Bug description:
  https://review.opendev.org/#/c/711195/ introduced pytest usage in
  horizon, but it breaks all horizon plugin tests as pytest is declared
  in test-requirements.txt and horizon plugin test environments do not
  install pytest.

  Here is an example of heat-dashboard failure.

  ======================================================================
  ERROR: heat_dashboard.test.tests.content.test_template_versions (unittest.loader._FailedTest)
  ----------------------------------------------------------------------
  ImportError: Failed to import test module: heat_dashboard.test.tests.content.test_template_versions
  Traceback (most recent call last):
    File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
      module = self._get_module_from_name(name)
    File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
      __import__(name)
    File "/home/user/src/opendev.org/openstack/heat-dashboard/heat_dashboard/test/tests/content/test_template_versions.py", line 17, in <module>
      from heat_dashboard.test import helpers as test
    File "/home/user/src/opendev.org/openstack/heat-dashboard/heat_dashboard/test/helpers.py", line 39, in <module>
      from horizon.test import helpers as horizon_helpers
    File "/home/user/src/opendev.org/openstack/heat-dashboard/.tox/lower-constraints/lib/python3.6/site-packages/horizon/test/helpers.py", line 45, in <module>
      import pytest
  ModuleNotFoundError: No module named 'pytest'

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1873532/+subscriptions


References