Commit Graph

117 Commits

Author SHA1 Message Date
Radomir Dopieralski caa99b2010 Switch to PyMemcacheCache backend
The new library is already supported in django 3.2 and gives us better
support for IPv6 addresses and encrypted connections.

Also, the same library is being used by all other OpenStack projects.

Depends-on: https://review.opendev.org/c/openstack/devstack/+/898302
Closes-Bug: #2039225
Change-Id: I964ac4d0d62dff4c1f7c1f1373763fbf23024269
2023-10-18 00:07:35 +09:00
Akihiro Motoki ffe84dbf9d Move linters dependencies to tox.ini
One of suggestions discussed in the mailling thread [1] is to decouple
linters from test-requirements.txt. We uses specific versions of linters
(hacking, flake8, pylint and bandit) and they are potentially incompatbile
with other libraries in test-requirements.txt.
One example is bandit incompatibility detected by the new pip resolver.
This commit moves linters to tox.ini and introduces a new tox envdir
shared by linter related tox envs.

Note that we have a unit test for a local hacking rule so hacking needs
to be installed as part of the default dependencies. We can have it in
test-requirements.txt but I think it is better to have it in tox.ini
as hacking is a part of linters and other linter dependencies are
declared in tox.ini now.

[1] http://lists.openstack.org/pipermail/openstack-discuss/2020-December/thread.html#19362

Change-Id: Ia41c5f665f01bdab187c9256b2319885998d12c3
2021-03-19 11:25:28 +09:00
David Hill f60220329a Get the timezone offset for the current day instead of January 1st.
This bug only appears to be a cosmetic one where the TZ offset
would be calculated on current_year/01/01 so would remain in
daylight saving offset when displaying the timezones list.

(Note by amotoki)
The minimum version of Babel is bumped to 2.6.0
as Babel 2.3.4 returns "New Zealand Time" instead of "New Zealand
(Auckland) Time" returned from the latest Babel (2.9.0).
It is not a good idea to handle such difference in Babel in our UT
and there is no reason to stick to Bump 2.3.4.
2.6.0 was chosen as it is available in Ubuntu Focal and there is
no more reason than this.

Change-Id: I0600086cc51cf5abcf1631565e75146114189667
Closes-bug: #1822849
2021-03-18 08:29:07 +09:00
Akihiro Motoki 235cbb839e Bump pylint version to support python3.8
pylint 2.2.2 which we currently use does not support python 3.8 [1].

Let's use a newer version of pylint.

pylint now declares strict versions for astroid and isort,
so we do not need to manage them in our test-requirements.txt.

All new checks are disabled temporarily. Let's visit them later and
judge whether we disable them permanently one by one.

[1] https://github.com/PyCQA/pylint/issues/2737

Change-Id: I106b250e632305365aaab4d881c9ba5ea93505b3
2020-09-10 11:43:57 +09:00
Akihiro Motoki cd3a97107d pep8: Cap isort version to <5
isort 5.0.0 is not API compatible with isort 4.0.0,
and our current pep8 job result has a lot of warnings:
module 'isort' has no attribute 'SortImports'.
A newer version of pylint has a version cap for isort, but
updating pylint version needs extra works.
Using isort 4.x looks like an easy workaround for us.

Change-Id: I0c6c9c60901cc6be012780e8e1399dab69b50a47
2020-09-03 11:48:26 +09:00
Ghanshyam Mann 4c78bfb021 Fix hacking min version to 3.0.1
flake8 new release 3.8.0 added new checks and gate pep8
job start failing. hacking 3.0.1 fix the pinning of flake8 to
avoid bringing in a new version with new checks.

Though it is fixed in latest hacking but 2.0 and 3.0 has cap for
flake8 as <4.0.0 which mean flake8 new version 3.9.0 can also
break the pep8 job if new check are added.

To avoid similar gate break in future, we need to bump the hacking min
version.

- http://lists.openstack.org/pipermail/openstack-discuss/2020-May/014828.html

Change-Id: I2b0ef5172dca775308b579d2912c97e3b94dbd5e
2020-05-13 15:51:32 +00:00
Zuul cbe1033502 Merge "Change horizon test runner to pytest" 2020-04-14 05:45:38 +00:00
Oleksii Petrenko d6fe0170ee Change horizon test runner to pytest
Changes test invocation from `manage.py test` to `pytest`. Adds addtitional
test requirements like pytest, pytest-django, pytest-html. Adds
`pytest.mark` alongside django's test `tag`. Adds posibility to export test
results into xml and html formats.

Depends-On: https://review.opendev.org/#/c/712315/
Related-Bug: #1866666
Co-Authored-By: Ivan Kolodyazhny <e0ne@e0ne.info>
Change-Id: Idb6e63cd23ca2ba8ca56f36eb8b63069bd211944
2020-04-03 13:47:18 +03:00
manchandavishal 393f2b6d61 Bump hacking to 3.0.0
This patch update hacking version to 3.0.0. It also drop flake8 and
hacking from lower-constraints.txt and update mccabe, pycodestyle,
pyflakes package version to fix error in lower-constraints job [1].

[1] https://zuul.opendev.org/t/openstack/build/b11dcae1771d4d9ab7d30c40848bd2ff/log/tox/lower-constraints-1.log#354-356

Change-Id: Idd32fc49cb7c8d9823385eee7b42e8e6e769c108
2020-04-03 09:21:05 +00:00
Ivan Kolodyazhny 14e779bbac Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I2de669d8e89b8daeb7ee5405ffab35af6307c40b
2020-03-26 19:45:37 +02:00
Stephen Finucane f66ef7b5ae tests: Convert 'OpenStackAuthTestsV3Base' to mock (pt. 4)
This completes Mox removal from Horizon.

Change-Id: I73f7a01b7f655f7c1d0ba704f4417d6fe798a7eb
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
2020-03-09 13:07:30 +00:00
Zuul 954ad0fdfc Merge "Fix pep8 failures with hacking 2.0.0" 2020-01-06 16:14:49 +00:00
Akihiro Motoki 3e54ba096f Complete "Drop Python 2.7 Support" goal
The goal definition in the TC repo [1] defines the completion criteria.
We have already completed 1, 2, 3 and partially 4 in [1].
This commit completes 4 (requirements.txt etc) and 5 (release note).

Python dependency in the installation guide is updated.
Django support plan in Ussuri is updated as well.
References to python 2.7 in the document are updated as well.

[1] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Change-Id: I0383920e32e053e1611519be774fab8dec124ccc
2019-12-29 01:42:54 +09:00
Akihiro Motoki a7b25f0cc4 Fix pep8 failures with hacking 2.0.0
It seems hacking 2.0.0 was shipped with incompatible changes
(which is not surprising as this is a new major version).
Let's fix these errors and use a newer hacking.

Change-Id: I8da9dca5d8d74f6dfc2340dabc8d50e6253358e2
2019-12-17 04:55:05 +00:00
Akihiro Motoki 7a7558b058 Cap hacking version to <2
Hacking 2.0.0 and its dependencies like flake8 have incompatible changes
and bumping to them leads to pep8 check failure.
It is good to address pep8 warnings in the master branch, but in case of
stable branches it is good to continue to use the same version of hacking.
This commit is proposed to the master branch so that it can be backported.

Change-Id: I2b174ef3231956037650eba19aebe5989dffa617
2019-12-16 15:04:06 +09:00
Akihiro Motoki 205ebe0f47 tox: Move doc8 to docs related envs
Previously doc8 is run as part of pep8 tox env. This leads to some tricky
'deps' in pep8 which installs the docs dependencies. This can be fixed by
moving doc8 to the docs related tox envs (docs and releasenotes).

This also helps developers using devstack avoid hitting an error in
"manage.py compilemessages" in stack.sh. The error is caused by sphinx
installed under .tox directory (as compilemessages tries to compile all
message catalogs even under dot directories like .tox).
Developers sometimes change the horizon code under /opt/stack/horizon
and it is not surprising to run "tox -e pep8".
(I think it is more common compared to a chance to run "tox -e docs".)
Thus I believe it is reasonable to move doc8 to the docs env.

Change-Id: I6345ebbcd24afc358555e9be4b2ca700c4b33861
2019-10-02 09:28:11 +09:00
manchandavishal 91a57e56e0 Blacklist bandit 1.6.0
There's a regression[0] in bandit 1.6.0 which causes bandit to stop
respecting excluded directories, and our tests throw a bunch of
violations. Blacklist this version, but allow newer versions as there is
already a pull request[1] to fix it, and I expect it will be included in
the next release.

[0] https://github.com/PyCQA/bandit/issues/488
[1] https://github.com/PyCQA/bandit/pull/489
For additional details, refer to ML Thread[1]

[1] http://lists.openstack.org/pipermail/openstack-discuss/2019-May/006116.html

Change-Id: I01b3ee75aa52b2711bacbf26690ce55a4c3f336e
2019-05-15 15:56:25 +05:30
manchandavishal 4e8e907986 Add python-memcached library to test-requirements.txt
Horizon uses python-memcached while running "tox -e runserver"
so we need to add it to test-requirement.txt as well as
lower-constraints.txt.

Change-Id: I4319cf1a54310171baf1dbaf2e10acae8123dac6
2019-03-06 06:02:55 +00:00
Akihiro Motoki 220b1346bd Enable pylint in horizon
tests.py files are excluded from targets checked by pylint
because it takes longer and longer time to check them somehow.

pylint 2.2.x is supported only in Python 3 and we already switched
our pep8 basepython to python3, so pylint and astroid are installed
only for python3. This seems the easiest way to ensure py27 env works.

literal-comparison error in openstack_dashboard/api/nova.py
is also fixed in this commit as it is simple enough.

Change-Id: Ic8868a44b296dba457be721716ca6f9d37ad9369
2019-01-12 22:41:20 +09:00
Akihiro Motoki cebe212d00 Bump hacking to 1.1.0
Fix the following new errors:
* E305 expected 2 blank lines after class or function definition, found 1
* E126 continuation line over-indented for hanging indent

max_line_length is set to 80 as the default value in pycodestyle is 79
but horizon uses 80 as max_line_length.

Ignore W504 and F405 by configurations.
Reasons of disabling them are explained as comments in tox.ini.

Change-Id: Iee8bcd60c30883fc8c74f08cf20af853cbb5e271
2018-11-10 16:44:25 +09:00
Akihiro Motoki de3e484798 Move requests to requirements.txt
requests is used in non-test code in horizon
(openstack_dashboard/exceptions.py).
It should be declared in requirements.txt.

Closes-Bug: #1789040
Change-Id: I325b5344d45f797d256bb213093082927068a88e
2018-08-26 03:49:36 +09:00
Ivan Kolodyazhny fe4a1f4051 Add Bandit non-voting job
This commit adds two new tox environments for bandit scanner. To run any
of them you can use tox commands:

1) 'tox -e bandit' to run bandit scanner against all the code
2) 'tox -e bandit-baseline' to run bandit scanner only against the last
commit or the current changes.

Bandit job uses 'bandit-baseline' tox environment to veryfy that no new
issues were introduced.

Change-Id: I1fc3bb0d5d151f215b9efc916f921fabaa72e7d8
2018-06-22 13:11:43 +03:00
Ivan Kolodyazhny 1f80d94459 Use default Django test runner instead of nose
Nose has been in maintenance mode for the past several years. It has
issue with exit code [1] which leads to false positive results for our
seleniun-headless job.

This patch changes test runner for Horizon tests and does the following
things:

* Django test runner  executes test in a different order than Nose does.
  That's why we've got an issue with side-effect in
  horizon.tests.unit.tables.test_tables.MyToggleAction class. This patch
  adds workaround to it.
* Rename filename of test files to names starting with 'test_'
  so that the django test runner can find tests expectedly.
* '--with-html-output' option is temporary dropped and will be added in
  a following patch.
* Integraion tests is marked via django.test.tag mechanism which is
  introduced in Django 1.10
* 'selenium-headless' is broken now because we don't have geckodriver on
  gates, this patch makes it non-voting.
* 'tox -e cover' is fixed
* Remove @memorized decorator from
  dashboards.project.images.images.tables.filter_tenant_ids function.

[1] https://github.com/nose-devs/nose/issues/984

Depends-On: https://review.openstack.org/572095
Depends-On: https://review.openstack.org/572124
Depends-On: https://review.openstack.org/572390
Depends-On: https://review.openstack.org/572391

Related blueprint: improve-horizon-testing
Change-Id: I7fb2fd7dd40f301ea822154b9809a9a07610c507
2018-06-08 15:21:12 +03:00
Zuul 9ab701b5e2 Merge "add lower-constraints job" 2018-03-29 09:11:12 +00:00
Doug Hellmann fdd3c8b462 add lower-constraints job
Create a tox environment for running the unit tests against the lower
bounds of the dependencies.

Create a lower-constraints.txt to be used to enforce the lower bounds
in those tests.

Add openstack-tox-lower-constraints job to the zuul configuration.

See http://lists.openstack.org/pipermail/openstack-dev/2018-March/128352.html
for more details.

---

horizon specific change:
* Django minimum version is bumped to >=1.11 as horizon rocky
  dropped Django 1.8-1.10 support.
* django-babel needs to be bumped to 0.6.2 to support Django 2.0
  8762ff5dc0
* nose-exclude needs to be bumped to 0.5.0 to run horizon unit tests
  properly. According to my test, 0.4.0 also works but this is
  a testing dependency, so we don't need to care multiple versions much.
  Otherwise only one test is run for openstack_dashboard unit tests.

https://review.openstack.org/555402 allows us to bump lower requirements.

Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
Change-Id: I73c3e4531c57d015f6016ca00b056a6fd0d8fc1a
Depends-On: https://review.openstack.org/555034
Depends-On: https://review.openstack.org/555402
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
2018-03-26 04:44:42 +09:00
Akihiro Motoki eac3eae35a Follow the new PTI for document build
The detail is described in the following links:
https://governance.openstack.org/tc/reference/project-testing-interface.html
http://lists.openstack.org/pipermail/openstack-dev/2017-December/125710.html

doc8 command is dropped from docs and releasenotes tox envs.
We run doc8 in pep8 tox env, so this hurts nothing.

Change-Id: I24271b527258b1de4cf26ca7efd625954eb834de
2018-03-25 02:14:40 +09:00
OpenStack Proposal Bot d01a505455 Updated from global requirements
Change-Id: Icd0237df4052d108035334b66c5ae2139d639e4a
2018-03-15 06:58:48 +00:00
OpenStack Proposal Bot 9fab80323b Updated from global requirements
Change-Id: I65c2f5d032c68494ab9a1bdbc96775c57873f056
2018-03-14 05:30:16 +00:00
OpenStack Proposal Bot a01dfc4a23 Updated from global requirements
Change-Id: I586ac5edaed0886fecb1691338590cda83990f66
2018-03-10 13:14:22 +00:00
Monty Taylor 835a4bb7ba
Update upper-constraints consumption
In order to deal with horizon going into the upper-constraints file so
that horizon plugins can consume it normally, we need to align the
constraints invocation in horizon's tox.ini. This means putting the -C
argument into the dependencies list rather than the pip install line so
that it doesn't get appended to tox installing horizon itself.

While we're in here, move nosehtmloutput into test-requirements so that
we don't need to do .[test] which also doesn't work with constraints.

Needed-By: https://review.openstack.org/550475
Change-Id: I736f79010c2d34e25d41d967a38128c2263ed13f
2018-03-08 07:22:54 -06:00
OpenStack Proposal Bot ca74561e78 Updated from global requirements
Change-Id: I28d8c180a5d45dd996d280a6a8a7c071679d111a
2018-01-24 00:54:44 +00:00
OpenStack Proposal Bot c5901fe34c Updated from global requirements
Change-Id: I15b865fc88f6cd4047edd04e51dab65c2ef9ca38
2018-01-17 20:34:25 +00:00
OpenStack Proposal Bot 68a62bd60b Updated from global requirements
Change-Id: Ie7a7e6613eb154b79c322d171005b91726b172fa
2017-11-16 11:04:47 +00:00
Rob Cresswell e3e5812b19 Add Django OpenStack Auth to Horizon
Moves Django OpenStack Auth content to Horizon, since they are so
tightly coupled. This cleans up the development workflow and should
make keystone / auth related contributions easier.

Implements: blueprint merge-openstack-auth
Change-Id: Ia1cdc47bad1ca6e633073a9f9445b0c7f70d05bc
2017-09-27 12:06:57 +01:00
OpenStack Proposal Bot 95764640b0 Updated from global requirements
Change-Id: I57d0633ae6ca64badb04fcad622ea14c4dfffcdd
2017-09-16 23:12:37 +00:00
OpenStack Proposal Bot 2139536d09 Updated from global requirements
Change-Id: I18c9d75607dc4652d6c8c2ce139106effd060fc8
2017-09-13 12:51:00 +00:00
OpenStack Proposal Bot 818d65d9c0 Updated from global requirements
Change-Id: I75b6fc8284a2824a0cae30835ff409cc5b0527f9
2017-09-11 23:28:30 +00:00
Thomas Bechtold 8d7b2ce3c0 Make nosehtmloutput an optional test requirement
It is not strictly needed.

Change-Id: I37b2623ec834533a7ecae63084e2c2c04ecc1751
2017-08-21 15:25:44 +02:00
OpenStack Proposal Bot c03ba4e1ee Updated from global requirements
Change-Id: I6df6d6a4c34f60cfd6e9f9248f41dc351ff851b4
2017-08-18 11:30:37 +00:00
OpenStack Proposal Bot 4dbbca3013 Updated from global requirements
Change-Id: I7a7fd6b1088556e301eb0d186326d4cb5b503e28
2017-08-18 04:41:10 +00:00
OpenStack Proposal Bot a0c599a3a8 Updated from global requirements
Change-Id: I64bb12e6549d5dd41d11b6f397a0830dca50d5bd
2017-07-27 19:10:12 +00:00
Akihiro Motoki 497cae2b57 Use doc8 check
doc8 is a linter for documents and used in openstack-manuals.
It is better to enforce document linters for simple checking.

The current rules are really simple like:
- line length check (80 chars)
- new line at the end of file

Change-Id: I3810df521068ffc97e25a5fc56b72397bf9783bc
2017-07-19 10:31:16 +00:00
Akihiro Motoki e6b78f92f2 Use flake8-import-order plugin
In reviews we usually check import grouping but it is boring.
By using flake8-import-order plugin, we can avoid this.
This flake8 plugin is already used in tempest.
It enforces loose checking so it sounds good to use.

Note that flake8-import-order version is pinned to avoid unexpected
breakage of pep8 job.

Change-Id: I8ccd05eb70350a2441cc2a4d1eafc09ee690b83b
2017-07-03 08:02:23 +00:00
OpenStack Proposal Bot 3552f8e87f Updated from global requirements
Change-Id: I99066250175bf71f73297936baba6a8ec531142c
2017-06-27 17:43:20 +00:00
Doug Hellmann e8d1dd99a6 remove oslosphinx from test-requirements
Horizon uses the openstackdocstheme and doesn't need oslosphinx.

Change-Id: I2cb1f0d03d5eab7b5288801877383bbf0aed93a6
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-24 17:32:52 +09:00
OpenStack Proposal Bot 1c410793cf Updated from global requirements
Change-Id: I5cdf968d8c444ef38c0a33b390a21b6ed798fb21
2017-06-10 21:37:41 +00:00
Rob Cresswell 6eb8394213 Update the quickstart guide
This patch is the first in a series improving Horizons documentation. It
aims to make the initial quick start section clearer, updates the
information to remove some redundant information, and updates the
appearance to match the rest of the openstack docs.

Change-Id: I942e62b6c2c272dc2b5c91bca42c77677bb4e09d
Implements: blueprint pike-docs-overhaul
2017-06-08 21:01:37 +01:00
OpenStack Proposal Bot 7d27a60dcb Updated from global requirements
Change-Id: I621d101f15941e97b2ff8eca9f023e7addcbe106
2017-06-02 21:55:59 +00:00
OpenStack Proposal Bot fb86cc3094 Updated from global requirements
Change-Id: I7617d5c362234edb2a34feef513ecda625535732
2017-05-17 13:39:51 +00:00
OpenStack Proposal Bot 1f9e7b685e Updated from global requirements
Change-Id: I9595fd8e16cf8cb33934d54f80ae32a69381aef1
2017-05-15 00:44:34 +00:00