160 Commits

Author SHA1 Message Date
lingyongxu
34e56199db Drop py34 target in tox.ini
Change-Id: Ic2c7016344ec3be49e52bcdf0db6da2ccb58f4f7
2017-03-23 20:52:41 +08:00
Akihiro Motoki
676d5a2bad hacking: Drop import_exceptions from tox.ini
Current hacking check actually does not check attribute-level
imports. We can safely drop import_exceptions from tox.ini.

noqa cleanup will be coming in subsequent patches.

Change-Id: Iee3e9cbf80b272cb71e658671913f8242f96f7e6
2017-03-17 19:38:47 +00:00
Radomir Dopieralski
c3b6fc761e Make extract_messages quiet in pep8 test
The additional extract_messages call in the pep8 tox environment
generates a lot of meaningless output, that then makes it difficult
to spot actual failures and warnings. This patch makes the Django
command respect the verbosity setting and call the setup.py command
with a quiet flag if low verbosity is requested, considerably decreasing
the amount of useless output. It then sets that verbosity to low in the
corresponding tox environment.

Change-Id: I2976250a23e800fbb582726299670b57199b58a7
2017-03-17 16:55:18 +01:00
Rob Cresswell
36d1d1ac68 Refactor tox & update docs
- Updated tox envlist, so just running `tox` from the CLI will now run all
voting gate tests

- Reduce duplicated definitions and commands

- Remove any reliance on run_tests within tox

- Removes all doc references to run_tests.sh, and replaces them
with their tox equivalent. Where necessary, language around the tox
commands has been altered or extended so that it makes sense and is
consistent with other parts of the docs. Also adds a new "Test Environment"
list to the docs, so that newcomers do not have to piece together CLI
commands and their cryptic extensions from tox.ini

- Move the inline shell scripting to its own file. Also fixes a bug when
passing args, since the logic assumed you were attempting a subset test
run (try `tox -e py27 -- --pdb` on master to compare)

- Moved translation tooling from run_tests to manage.py, w/ help text
and arg restrictions. This is much more flexible so that plugins can use
it without having to copy commands, but still defaults to exactly the
same parameters/behaviour from run_tests. Docs updated appropriately.

- Removed npm/karma strange reliance on either .venv or tox/py27. Now
it only uses tox/npm.

Change-Id: I883f885bd424955d39ddcfde5ba396a88cfc041e
Implements: blueprint enhance-tox
Closes-Bug: 1638672
2016-11-30 20:38:59 +00:00
Jenkins
15c8cc311e Merge "Turn on docs warning check in document generation" 2016-09-30 20:57:40 +00:00
eric
f23b7d1fd1 Fix tox cover to not fail
This changes the run of tox with cover, to just ammend cover
output data.... the combine option seemed to be breaking the data
and then the xml / html options did not work as a result.

Change-Id: Ic600b55855cf74c1b6ed138fea5c4b7bb037de82
Closes-bug: #1628661
2016-09-28 21:21:10 +00:00
Akihiro Motoki
f880f6c723 Turn on docs warning check in document generation
Use -W (turn warnings into errors) option of sphinx-build
in the commandline of 'docs' tox target so that developer
can easily check sphinx warning.

Also runs the same documentation check in 'pep8' tox target
to detect sphinx warning in the gate.
The current 'docs' job in the gate does not use 'tox -edocs'
intentionally and calls build_sphinx via 'tox -evenv' [1],
so sphinx warnings are not detected in the 'docs' job.

Note that we no longer generate the whole code reference so this
change does not increase the time of 'tox -epep8' much,
while we can prevent new sphinx warnings.

[1] 6b50d7e3a6/jenkins/scripts/run-docs.sh (L16-L19)

Closes-Bug: #1411719
Closes-Bug: #1486222
Change-Id: Idc6e8a1c5762eba113b2d110d5fa223ab7406be3
2016-09-24 20:44:48 +09:00
Richard Jones
b05658735b Enable Python 3.5 testing and fix tests
Fixes to a couple of places to make the python 3.5 tests pass.

Change-Id: I3f4b73b24fbe336ac6c80b7aa224a830ab7e36a6
2016-09-06 14:41:15 +10:00
Richard Jones
63ddedf69d Fix error detection in horizon test suite
Also, simplify tox environment by reducing repeated definition of the same
test command across all of the "test suite" environments.

Change-Id: Icbe7558b973dcd1ef50c85cdefc02e165b5bdc7c
Closes-Bug: 1620430
2016-09-06 11:21:18 +10:00
jing.liuqing
1918ea3f3d [TrivialFix] Ignore node_modules while we run flake8 test
Boring to see a bunch of flake8 error of from
node_mpdules directory, especially in summer.

Change-Id: Ice1e5af164bc8a6f60df233ab8e3a6bf06704ad4
2016-08-30 22:23:10 +08:00
AvnishPal
7126d0d50f Use upper constraints for all jobs in tox.ini
Openstack infra now supports upper constraints for
all jobs. Updated tox.ini to use upper constraints
for all jobs.

Change-Id: I0ee155178bf416f4cf955aa19c6273984fdd1f04
Closes-Bug: #1614361
2016-08-22 16:59:57 +05:30
shizhihui
21eed0b726 Remove openstack/common from the exclude list of flake8 in tox
The Oslo team has moved all previously incubated code from the
'openstack/oslo-incubator' repository into separate library
repositories and released those libraries to the Python Package
Index, so the directory should be removed.

Change-Id: Iba22758f26152f847b518ba899c2e3d8eb5d678f
2016-08-07 11:09:14 +08:00
Rob Cresswell
bdbc68302f Update Django 1.10 tox env
Updates the django 1.10 tox env to strictly look for django 1.10, rather
than just the next release.

Change-Id: I0edd4f2481a43196c1da6bfc6e713fddae03e582
Implements: blueprint dj110
2016-08-04 20:57:20 +00:00
Jenkins
d3ad1040b2 Merge "Enable tox to run the subset test cases." 2016-07-21 13:52:45 +00:00
wangbo
c135ffaad2 Enable tox to run the subset test cases.
Now the tox.ini is hardcode that could only run all test cases
in horizon/ and openstack_dashboard/. Following usage does not work:
"tox -e py27 openstack_dashboard.test.tests.policy:PolicyTestCase"
This patch enable pass args to run subset test cases.

Remove envs py27{-horizon,-openstack_dashboard}, you could run
"tox -e py27 horizon/openstack_dashboard".

Partially-Implements: blueprint enhance-tox
Change-Id: I21224d49a7a6e07d0184871b21268199def76db6
2016-07-01 19:15:39 +08:00
Rob Cresswell
97f89f9464 Add Django 1.10 tox env
This will be used for a non-voting test run by infra.

Change-Id: Ie773fbb2ff8451bc974b570e2e2e7304b72a9e05
Implements: blueprint dj110
2016-06-29 09:32:59 +00:00
Andreas Jaeger
96984f8af0 Fix coverage post job
Coverage job is run in post queue, so cannot use constraints currently.
Use unconstrained install command to fix coverage post job.

Failure:
http://logs.openstack.org/fe/fe76b2f11f07d4c9f5a0f0ab117e05924e6babbe/post/horizon-coverage/18273d9/

Change-Id: I0c9e027ffbb926b3e4646c5b2cf1fec577a91d31
2016-06-14 21:04:07 +02:00
Jenkins
e7f09d758e Merge "Implement video capture for failed tests" 2016-06-08 08:43:07 +00:00
Sergei Chipiga
d63f93a819 Implement video capture for failed tests
Example of video recording Idd218e09c0f8df8ec7740173d5f2d856b8baafa1

Change-Id: I350950095f840f63638175b09ed083109aada2da
Closes-Bug: #1585092
2016-06-07 13:09:47 +03:00
Richard Jones
315958aab8 Use upper-constraints in tox test environments
Recently OpenStack introduced a mechanism to specify a constrained
"working set" of packages that are "guaranteed" to produce a working
OpenStack environment. This pinning of packages limits the more
broadly-defined requirements.txt which is managed by
global-requirements.

This patch modifies our tox test environment to use upper-constraints
and explictly removes those requirements from the "venv" tox
environment that is used by some commands in infra.

Change-Id: I84582370e139fc5812bc85ae5341f7f9c8b93ff5
Closes-Bug: 1554791
2016-05-20 13:31:50 +10:00
Zhenguo Niu
1d7e3885b2 Whitelist 'rm' in pep8 tox environment
Running the pep8 environment currently warns that 'rm' is not
installed in testenv. This patch removes the warning by whitelisting
the rm command.

Change-Id: I822195990d345ddd08237f9696651c71ad59b9d2
Closes-Bug: #1583025
2016-05-18 16:21:42 +08:00
Andreas Jaeger
654dfb7f5d Update tox.ini for pot files not in tree
The translation import fails since we do not store pot files in tree
anymore. Replace the "git checkout" after testing message extracting
with a simple rm. Note that we cannot use a wildcard in tox.ini for the
rm, instead give full names.

This is a followup to Ief0861e01ff758120001f4c8dfdbf9afadf09f5b.

Change-Id: I0fc59a444cfca9ffdf7e7eaa73ba321295c2aa2e
2016-05-10 15:04:55 +02:00
Itxaka
a67d75fa58 Enhances tox to not rely on run_tests
Several changes:
 - Dont rely on run_tests.sh and run the commands directly
 - Move the coverage options to the setup.cfg
 - Set py27 envs under the same umbrella
 - Split horizon and openstack_dashboard tests into 2
different envs
 - Remove usedevelop from most envs as its not needed
 - Set basepython to 27 on the default env
 - Allow adding posargs to py34 env
 - Add npm environment which defaults to npm run test
 - Add runserver as a new env
 - Move pep8 to be the first tests so we fail fast
 - Provide an env to tests against system packages, useful
for package builders that DONT want to test against pip
install but their local packages installation.
 - Allow to pass TOX_EXTRA_DEPS to the system_packages
tests in case some extra pip packages are needed
 - Add a manage env to pass commands to manage.py
 - Add an environment to createmessages
 - Add an environment to check only if we can create
messages
 - pep8 environment also runs the check for messages
 - All python commands use {envpython} so no escape
from the venv is possible
 - Uses {toxinidir} for a clear indication of where
the files to be executed are
 - Moves all keywords for pybabel to the setup.cfg
 - Removes not needed whitelist_external for all envs
and uses only git for one specific env

Change-Id: Ia1be8f60265d9dab2639a05912b4b7c51f1d4033
Implements: blueprint enhance-tox
2016-04-20 12:56:53 +02:00
Itxaka
0c118e4339 Remove PYTHONHASHSEED=0 from tox
Remove PYTHONHASHSEED=0 so the tests run
with a random seed.

Change-Id: I681d2b37453642b4823e8341a03d077ebc9cb9a7
Closes-Bug: #1348818
2016-03-31 14:06:26 +00:00
Victor Stinner
7b55a2f71b Port last unit tests to Python 3
With this change, all Horizon unit tests pass on Python 3.4.

Changes:

* vpn/tests.py, firewalls/tests.py: Replace reverse_lazy() with
  reverse() to get a regular Python string. The lazy object caused
  failures on Python 3.
* routers/tests.py: Decode HTTP body to get Unicode on Python 3. It
  works also on Python 2.
* neutron.py: replace a/b with a//b to get an integer on Python 3.
* network_tests.py: remove useless copy.deepcopy() which caused a
  recursion error on Python 3.
* metadata_defs/tests.py: expect a different JSON error message on
  Python 3.
* tox.ini: remove openstack_dashboard whitelist, all unit tests now
  pass on Python 3 ;-)

Partial-Implements: blueprint porting-python3
Change-Id: I7b4f036fc86b66c92cccafe6938a906045f03186
2016-02-10 18:22:52 +01:00
Jenkins
55465adb32 Merge "Port identity provider dashboard to Python 3" 2016-02-10 02:01:41 +00:00
Victor Stinner
68de571097 Port identity provider dashboard to Python 3
* Fix usage of Mapping() of keystoneclient.v3.contrib.federation:
  pass a manager instance, not a manager class.
* Simplify DataTable.get_object_display().
* tox.ini: add identity_providers to Python 3.4.

Co-Authored-By: Timur Sufiev <tsufiev@mirantis.com>
Closes-Bug: 1543073
Partial-Implements: blueprint porting-python3
Change-Id: I066359734624023b3f3776e8dbd54237d298e455
2016-02-09 10:29:06 +01:00
Victor Stinner
34ef42a923 Port dashboard containers to Python 3
On Python 3, Content-Disposition header is encoded using MIME format
'=?utf-8?b?...?='. Use decode_header() of email.header to decode it.
Handle also Unicode/bytes issues on this header.

tox.ini: Add openstack_dashboard.dashboards.project.containers to
Python 3.4.

Partial-Implements: blueprint porting-python3
Change-Id: Id5898ee5494d019d1397ed3fa5e0a715e9a0393f
2016-02-03 09:13:11 +01:00
Victor Stinner
95dc25bf8a Port volume backup dashboard to Python 3
Stop using deprecated data_type_singular and data_type_plural:
replace them with action_present and action_past properties to handle
correctly singular/plural.

Partial-Implements: blueprint porting-python3
Change-Id: I4fc3acf2da27348f371d3e387588baafc286605a
2016-01-18 15:07:35 +01:00
Victor Stinner
b1df7d1389 Port loadbalancers tests to Python 3
* Convert reverse_lazy() to get a regular string, not a lazy()
  object. lazy objects lack methods like .encode().
* don't compare None with int: test if delay is None before comparing
  it to timeout.
* tox.ini: add openstack_dashboard.dashboards.project.loadbalancers
  to Python 3.4

Partial-Implements: blueprint porting-python3
Change-Id: Icd2d6db1aae79a9584af1760e21f733d8f5f7f7d
2016-01-18 15:07:32 +01:00
Rob Cresswell
49ce86538e Add py27dj19 tox env
This adds a failing Django 1.9 tox env. This will be followed by a
non-voting Jenkins job to show the tests failing, and then a follow up
patch to make them pass.

Change-Id: I0534746360266e4a99e014d69ac19ab2d5b44a83
Partially-Implements: blueprint drop-dj17
2016-01-12 18:56:24 +00:00
Timur Sufiev
7023050edd Eliminate mutable default arguments
The best practice in Python is not to use mutable object (i.e. list,
dictionary, or instances of most classes) as value of default
argument (see https://goo.gl/Kwhg0T). A hacking rule to enforce this 
practice is added as well.

The patch was inspired by CR https://review.openstack.org/#/c/198465/ 
and took most of its code from it as well. That's why original 
copyrights are kept.

Closes-Bug: #1471349
Change-Id: Ia77b1736dbc3d4e28ff2d2c3424e9cfcaefa5077
2015-12-17 09:58:46 +00:00
Ondřej Nový
85e69f6987 Deprecated tox -downloadcache option removed
Caching is enabled by default from pip version 6.0

More info:
https://testrun.org/tox/latest/config.html#confval-downloadcache=path
https://pip.pypa.io/en/stable/reference/pip_install/#caching

Change-Id: I9d3a8051ed554e8400f2da0d11390bab194af34c
2015-12-11 21:17:30 +01:00
Jenkins
156cc7b948 Merge "Excising Sahara from Horizon" 2015-12-05 09:48:11 +00:00
David Lyle
4fbe4af80e Excising Sahara from Horizon
The content is proposed to the openstack/sahara-dashboard repo.

Change-Id: Ie76b09b9bdbdb975c1cd39658f02bcf95b98b961
2015-12-03 22:52:23 +03:00
lin-hua-cheng
380b81e21f Force releasenotes warnings to be treated as errors
Ensure the releasenotes can always be built and rendered properly.

Change-Id: I78e09804d51416c045d3569ed7fe90eb77dc9b21
2015-12-01 00:15:56 -08:00
Jenkins
8f51c884e0 Merge "tox: add /bin/bash to whitelist_externals" 2015-11-17 05:56:12 +00:00
Rob Cresswell
f2b2289b4a Drop Django 1.7 support
Django 1.7 support ends in December 2015
(https://www.djangoproject.com/download/#supported-versions), so it
will not be supported by Mitaka release.

This patch removes many of the deprecation warnings:-

`RedirectView.permanent` change:
https://docs.djangoproject.com/en/1.8/ref/class-based-views/base/

`url` change:
https://docs.djangoproject.com/en/1.8/internals/deprecation/
See version 1.5 notes for the url and ssi template tag change

`django.forms.utils` change:
https://docs.djangoproject.com/en/1.8/internals/deprecation/
See version 1.9 notes

`firstof` change:
https://docs.djangoproject.com/en/1.8/internals/deprecation/
See version 1.8 notes for cycle and firstof template tags

Change-Id: If546c087e73d189daa92e5bd63f0533fcf19089f
Partially-Implements: blueprint drop-dj17
2015-11-16 11:55:38 +00:00
Jenkins
9547fc3e3d Merge "Add reno for release notes management" 2015-11-16 09:15:52 +00:00
lin-hua-cheng
0ffb6d8045 Add reno for release notes management
An initial patch to add reno and create a base directory for
release notes

Change-Id: I4be108a22d4e67ebfc4483fbf45f9feffbac1e15
2015-11-11 02:38:47 -08:00
Victor Stinner
80ae31f461 Fix Python 3 issues in dashboard image tests
* Use NamedTemporaryFile instead of TemporaryFile because we must
  have a name which is a text on Python 3. Otherwise, the test fails.
  On Python 3, TemporaryFile uses an integer for the file name, the
  file descriptor.
* Replace filter() and map() with list comprehensions to get a list
  on Python 3.
* On Python 3, temporary files are open in binary mode so write a
  byte string instead of a text string.
* tox.ini: enable all image tests on Python 3.

Partial-Implements: blueprint porting-python3
Change-Id: Ice7f119c040bbddeda10ed45d137bb7851764b8d
2015-11-09 10:49:41 +01:00
Victor Stinner
aa86eea98c Port network topology tests to Python 3
Replace json.loads() with oslo_serialization.jsonutils.loads() to
accept bytes (HTTP body). jsonutils.loads() decodes the HTTP body
from UTF-8.

tox.ini: add network_topology tests to Python 3.

Change-Id: I9f65d63e3ed54525e52b92b7728b78cf1b9e7bb5
2015-11-09 10:49:06 +01:00
Victor Stinner
68764f741f Port dashboard stack tests to Python 3
* On Python 3, the pretty JSON output doesn't add space before newline.
* CreateStackForm: don't compare str to int, it raises a TypeError on
  Python 3. Instead, use MinLength already converted to int.
* tox.ini: enable all stacks on Python 3.

Partial-Implements: blueprint porting-python3
Change-Id: I20cd9e83720cc3974973bec5471864f0ffc00716
2015-11-09 10:49:03 +01:00
Victor Stinner
2b7cd38515 Port dashboard router tests on Python 3
* Decode HTTP body from UTF-8 to get text on Python 3
* tox.ini: add routers tests to Python 3

Partial-Implements: blueprint porting-python3
Change-Id: Idc93818c4b62f782035604090b7c6fda459cf6fa
2015-11-09 10:45:58 +01:00
Victor Stinner
49671ca4cf Port project instance tests to Python 3
* Fix division: replace a/b with a//b to get integers
* test_clean_file_upload_form_invalid_data(): use a byte string, not
  an unicode string for the test. The test ensures that decoding from
  UTF-8 fails.
* quotas: replace filter() with a list-comprehesion to get a list on
  Python 3.
* tox.ini: add the following tests to Python 3.4

  - openstack_dashboard.dashboards.project.instances.tests
  - openstack_dashboard.test.tests.quotas

* tox.ini: add also
  --exclude-dir=openstack_dashboard/test/integration_tests to
  openstack_dashboard tests on Python 3.4

Partial-Implements: blueprint porting-python3
Change-Id: I7caed713222b50ffec431155e6f91b543f7df466
2015-11-09 10:44:25 +01:00
Victor Stinner
8b675a91cf tox: add /bin/bash to whitelist_externals
Since tox 1.5, commands outside the virtual environment must be
explicitly listed in whitelist_externals. Without that, some commands
emit the warning:

    WARNING:test command found but not installed in testenv
       cmd: /bin/bash
       env: ...
    See also the whitelist_externals envconfig setting.

Change-Id: Iad1f623defbb32dafb5bad3613cec7a8409e2b2c
2015-11-09 10:37:39 +01:00
Victor Stinner
e6e87aa55e py3: Fix unicode versus bytes issues
* DataTable: don't try to decode Unicode from UTF-8. Only decode on
  Python 2.
* Use oslo_serialization.jsonutils.dump_as_bytes() to encode JSON
  as bytes.
* Use oslo_serialization.jsonutils.loads() instead of json.loads() to
  accept bytes string as input. On Python 3, json.loads() only
  accepts Unicode string.
* Fix unit tests: HTTP body type is bytes.
* Container tests: use a named temporary file, the function handling
  the filename fails. On Python 3, TemporaryFile() uses a number for
  the filename: the file descriptor.
* Don't encode filename to UTF-8 on Python 3, keep Unicode.
* tox.ini: add 2 admin tests on Python 3.4.

Partial-Implements: blueprint porting-python3
Change-Id: Ib7e2cb17f20474590fac18faf8116131692ad694
2015-11-08 23:48:47 +01:00
lawrancejing
3e675d5ed3 Port admin metering tests to Python 3
Replace json with oslo_serialization

Change-Id: I065bf68b55fca28481ae760dc4e9ba3c5822c3e0
Partial-Implements: blueprint porting-python3
2015-10-15 14:32:25 +00:00
Victor Stinner
1f29e5cd67 py3: Replace unicode with six.text_type
Run the unicode operation of the sixer tool on openstack_dashboard/
directory.

tox.ini: Add the following tests to Python 3.4:

* openstack_dashboard.contrib.sahara.content.data_processing.data_sources.tests
* openstack_dashboard.contrib.sahara.content.data_processing.job_binaries.tests
* openstack_dashboard.contrib.sahara.content.data_processing.jobs.tests
* openstack_dashboard.dashboards.project.networks.tests

Partial-Implements: blueprint porting-python3
Change-Id: Ibfe52ccbccc30e6b1d59137c68942c9860805397
Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>
2015-10-14 08:58:36 +02:00
Jenkins
71b4569a69 Merge "py3: Add json attribute to HTTP response objects" 2015-10-14 02:28:39 +00:00