ansible / django-ansible-base

Apache License 2.0
11 stars 43 forks source link

Fix flaky test failure #504

Closed AlanCoding closed 2 months ago

AlanCoding commented 2 months ago

Reproducer:

py.test test_app/tests/ -k "test_get_system_user_create_raises_exception or test_get_role_definition"

Without this patch, it fails with:

=========================================== short test summary info ===========================================
FAILED test_app/tests/rbac/api/test_rbac_views.py::test_get_role_definition - AssertionError: assert {'local.view_inventory', 'local.change_inventory'} == {'aap.view_inventory', 'aap.change_inventory'}

  Extra items in the left set:
  'local.change_inventory'
  'local.view_inventory'
  Extra items in the right set:
  'aap.view_inventory'
  'aap.change_inventory'

  Full diff:
    {
  -     'aap.change_inventory',
  ?       ^^
  +     'local.change_inventory',
  ?      +++ ^
  -     'aap.view_inventory',
  ?       ^^
  +     'local.view_inventory',
  ?      +++ ^
    }

With this patch, it passes. The test test_get_system_user_create_raises_exception was leaving around a modified INSTALLED_APPS for the rest of the test run.

Introduced in https://github.com/ansible/django-ansible-base/pull/433

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud