124 Commits

Author SHA1 Message Date
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
Jenkins
2d31c4d2aa Merge "Replace filter() with list-comprehension" 2015-10-14 02:28:22 +00:00
Victor Stinner
2d993b4acc Replace filter() with list-comprehension
Replace filter() with list-comprehension when a list is expected. On
Python 3, filter() returns an iterator, not a list.

tox.ini: add openstack admin volume tests to Python 3.4.

Partial-Implements: blueprint porting-python3
Change-Id: Id99124bf0ef5549c596d94f5d10ab5f88a4e200a
2015-10-13 10:39:58 +02:00
Victor Stinner
2a28eea8aa Port remaining Horizon tests for Python 3
* XSS check: don't check the exact HTML output because the attributes
  of the <a> tag are rendered on a different order depending on the
  hash function. On Python 3, the hash function is now randomized.
* Replace table.columns.values() with list(table.columns.values())
  to get a list on Python 3.
* WorkflowsTests: cast the HTTP response to bytes(), not to str().
  On Python 2, bytes is str so the test pass on Python 2 and Python 3.
* tox.ini: run all Horizon tests on Python 3 (but keep the whitelist
  for the openstack dashboard)

Partial-Implements: blueprint porting-python3
Change-Id: I19c5710fe53c6cdd3814a1615cef7b27339c444c
2015-10-06 16:05:15 +02:00
Victor Stinner
ee426f91d6 py3: Add json attribute to HTTP response objects
Add a json attribute to CreatedResponse and JSONResponse of
openstack_dashboard.api.rest.utils.

This patch changes unit tests: they now compare deserialized JSON
data instead of comparing the serialized JSON data which depends on
the exact hash function

This change makes the code more readable, but it was written to port
openstack_dashboard to Python 3. On Python 3, the hash function is
now randomized by default, so dictionary items are serialized in a
random order by JSON. Moreover, the hash function is different on
Python 2 and Python 3, so setting PYTHONHASHSEED=0 in tox.ini is not
enough to have a reliable JSON serialized ouput in all cases.

Fix also NaNJSONEncoder: On Python 3, don't try to decode bytes from
the encoder encoding, since the JSON encoder has no more encoding on
Python 3: it produces an Unicode string.

Partial-Implements: blueprint porting-python3
Change-Id: I8503ee530d4122b2ce733d02023454796934c8e6
Co-Authored-By: Richard Jones <r1chardj0n3s@gmail.com>
2015-10-06 14:17:19 +02:00
Jenkins
94078df256 Merge "Port horizon utils tests to Python 3" 2015-10-06 11:26:35 +00:00
Jenkins
2c3f81e00e Merge "Port openstack dashboard overview tests to Python 3" 2015-10-06 11:26:22 +00:00
Jenkins
f6e507ddc2 Merge "Fix Python 3 issue in horizon DataTable" 2015-10-05 20:18:35 +00:00
Jenkins
a2c1e79cde Merge "Port babel_extract_angular tests to Python 3" 2015-10-02 16:42:33 +00:00
Victor Stinner
65dac7f412 Port horizon tabs tests to Python 3
* get_cells(): cast dict.values() to a list to return a list
  on Python 3. On Python 3, dict.values() now returns a view.
* Replace dict.values()[0] with list(dict.values())[0]
* get_tabs(): replace filter() with a list-comprehension to return a
  list on Python 3
* tox.ini: add horizon.test.tests.tabs to Python 3.4

Partial-Implements: blueprint porting-python3
Change-Id: I0ebcaa5f7b283d04425ce7201087220376257d41
2015-09-30 18:33:43 +02:00
Victor Stinner
7f3729f95c Port babel_extract_angular tests to Python 3
* Fix AngularGettextHTMLParser constructor: call the constructor of the
  right parent class.
* tox.ini: Add horizon.test.tests.babel_extract_angular to Python 3.4

Partial-Implements: blueprint porting-python3
Change-Id: I020f9655baf18326f3752b82a8c3bf385c8e1e24
2015-09-30 18:26:28 +02:00
Victor Stinner
46ff8f5ddd Fix Python 3 issue in horizon DataTable
* Replace dict.values()[0] with list(dict.values())[0]. On Python 3,
  dict.values() returns a view which is not indexable.
* tox.ini: add the following tests to Python 3.4

  - openstack_dashboard.dashboards.identity.users
  - openstack_dashboard.test.api_tests.glance_tests
  - openstack_dashboard.test.api_tests.heat_tests

Partial-Implements: blueprint porting-python3
Change-Id: I68dbe85750399263938b1bf5a342fbb90de83861
2015-09-29 21:05:08 +02:00
Victor Stinner
078783cb35 Port openstack dashboard overview tests to Python 3
* Fix CsvDataMixin: replace map() with a list-comprehension to get a
  list on Python 3, because the sequence is consumed more than once. On
  Python 3, map() returns an iterator which can only be consumed once.
* tox.ini: add openstack_dashboard.dashboards.project.overview.tests
  to Python 3.4.

Partial-Implements: blueprint porting-python3
Change-Id: I9fb71a0b45c1e0a083c91476970938df5c649806
2015-09-28 21:38:12 +00:00
Victor Stinner
e16095fe16 Port horizon utils tests to Python 3
* Use literal octal number syntax instead of the oct() function. The
  oct() function gives a different result on Python 2 and Python 3
  (Python 3 uses the "0o" prefix, not Python 2).
* format_value() explicitly cast the result to float. It's needed on
  Python 3 to cast a Decimal to float, because round(Decimal) returns a
  Decimal.
* tox.ini: run all horizon.test.tests.utils tests on Python 3.4

Partial-Implements: blueprint porting-python3
Change-Id: Ifd7c0e16ea85b691b81659acb010e9eb6f982d13
2015-09-28 21:35:49 +00:00
Victor Stinner
bc35f98723 TestCase: add aliases to assert methods on py3
The Python 2 assertItemsEqual() method was renamed to
assertCountEqual() in Python 3, and assertNotRegexpMatches() was
renamed to assertNotRegex(). Add aliases in
horizon.test.helpers.TestCase.

tox.ini: add horizon.test.tests.messages to Python 3.4.

Partial-Implements: blueprint porting-python3
Change-Id: If7abd51fd3559a5ab32d433c6dc3476bd678b2bf
2015-09-15 16:17:20 +02:00
Victor Stinner
46628f0cb1 Port horizon base tests to Python 3
* Replace registry.keys() with list(registry). On Python 3,
  dict.keys() now returns a dictionary view, whereas we need a copy
  of keys here.
* CustomPanelTests: load horizon.test.customization.cust_test1
  configuration after calling setUp() and force a reload of URLs.
  BaseHorizonTests.setUp() keeps original panels for each dashboard
  to be able to restore them in tearDown().
* tox.ini: run all horizon.test.tests.base tests on Python 3.4, not
  only horizon.test.tests.base.GetUserHomeTests.

Without the CustomPanelTests change, 3 tests fail with NoReverseMatch
when running the base test on Python 2 with the following command (in
the .tox/py27/ virtual environment):

    python manage.py test --settings=horizon.test.settings \
        horizon.test.tests.base

Partial-Implements: blueprint porting-python3
Change-Id: Ibdd5fcaa863c6eaae4a519f3d1b56034f0ef9708
2015-09-15 09:12:02 +00:00
Jenkins
dee5c9d3f4 Merge "Replace SortedDict with OrderedDict" 2015-09-09 03:33:27 +00:00
Jenkins
14fd7b0a10 Merge "Port dashboard api access tests to Python 3" 2015-09-08 18:57:33 +00:00
Jenkins
accc2ccc47 Merge "Port horizon forms tests to Python 3" 2015-09-08 17:43:36 +00:00
Jenkins
757ad1c878 Merge "Port password tests to Python 3" 2015-09-07 04:04:29 +00:00
Masco Kaliyamoorthy
4e8549ee9a Replace SortedDict with OrderedDict
From django V1.9 django.utils.datastructures.SortedDict
will be removed and it is deprecated in V1.7.

The similar functionality is added in collections.OrderedDict
from python 2.7.

Horizon code also should avoid the SortedDict class and
start using the OrderedDict class.

This patch replacing the SortedDict with OrderedDict.

Change-Id: I8dfcf7c29fc49b6215451f160cf7a951bf11b5ad
Closes-Bug: #1492270
2015-09-04 18:39:15 +00:00
Victor Stinner
9bb81be1de Port dashboard api access tests to Python 3
HTTP body type is bytes: encode expected string to get bytes in the
unit test.

Change-Id: I3fa03012c3ca9005dc2fae94054b3ef5f58098f0
Partial-Implements: blueprint porting-python3
2015-09-04 16:07:38 +02:00
Jenkins
fc1244708b Merge "Port config_rest_tests to Python 3" 2015-09-04 10:53:38 +00:00
Victor Stinner
c63d7a6390 Port password tests to Python 3
* load_template_source(): use io.open() with an encoding instead of
  open(), to have the same behaviour on Python 2 and Python 3
* assertRedirectsNoFollow(): remove an useless assertion on the
  response status code which is already tested a few lines below. The
  assertion used code/100 which returns a float on Python 3, whereas
  an int was expected.
* add_logout_reason(): don't encode reason to UTF-8 on Python 3
* tox.ini: add openstack_dashboard.dashboards.settings.password to
  Python 3.4

Partial-Implements: blueprint porting-python3
Change-Id: Iff8997917b5d812952150b2abe89ddd12deab0c0
2015-09-04 12:27:04 +02:00
Victor Stinner
a8433dfad5 Port horizon forms tests to Python 3
HTTP body type is bytes: encode expected text to UTF-8 to get bytes.

Partial-Implements: blueprint porting-python3
Change-Id: I5436728aad256a650511d8b206ac2916c2ea574e
2015-09-02 16:22:15 +02:00
Victor Stinner
c8bf36d815 Port error_pages tests to Python 3
HTTP response type is bytes: use a literal byte strings, instead of a
Unicode string.

Partial-Implements: blueprint porting-python3
Change-Id: I989a4da786652058e5204386a70e298ec0e7b8e3
2015-09-01 18:38:55 +02:00
Victor Stinner
bc5d12f3d0 Port config_rest_tests to Python 3
* ConfigRestTestCase: remove assertContains and assertNotContains
  methods, reuse assertIn and assertNotIn instead.
* Fix also the HTTP body type is byte string.
* tox.ini: add config_rest_tests to Python 3.4

Partial-Implements: blueprint porting-python3
Change-Id: I8cd28b4ed13ea07d77ff4c33d37162d8bf89a3a6
2015-09-01 18:35:44 +02:00
Victor Stinner
88983a8a65 Run a subset of tests on Python 3
Fix "tox -e py34" by only running a subset of tests which pass on Python
3.4. It should fix the py34 gate. If the gate pass, we can make it
voting to avoid Python 3 regressions.

Then we can add more tests to this list when fixing more Python 3
issues. The final goal is to remove the whitelist when all tests will
pass on Python 3.

Partial-Implements: blueprint porting-python3
Change-Id: I3e56789097162f9efc93b889e54b95147ea1f2dc
2015-08-28 16:31:41 +02:00
Matthias Runge
ee6165fb04 remove django<1.7 from tests
Django_openstack_auth is moving to Django-1.8, Django < 1.7 is
not supported any more by upstream.

Added tox sections to gate on django-1.7 and 1.8
(to be configured in project config)

remove python33 tests, to.

Partly Implements: blueprint django18

Depends-On: I73e1f52465545888f70a6e398511c84f04bb7bf7
Change-Id: I4c417a058b5d9e419703099dd7e0df865dad2606
2015-08-13 19:36:28 +02:00
Michael Krotscheck
eff59ac2dd Removed JSHint
JSHint is being deprecated by the Horizon project. This removes all
references, commands, and documentation related to this tool. The
patch depends on the deactivation patch for jshint in infra.

Change-Id: I1a799f39023e0598a58d912a4288300ec8340dd9
Depends-on: Ifb59af36ae37926133769c655e54f4c2e1edf095
Partially-Implements: blueprint jscs-cleanup
2015-07-01 09:11:21 -07:00
Michael Krotscheck
c6c0352982 Switched from JSCS to ESLint
This patch switches horizon from using JSCS to using ESlint. It
adds the john papa style guides as an eslint plugin, and deactivates
additional linting rules so current cleanup efforts can focus on the
issues remaining from JSCS. Once that cleanup effort is complete,
we can switch our linting job to voting and move forward from there.

YAML for .eslintrc was chosen because the JSON specification does
not allow comments, and having comments (including rule links) will
make it easier to discuss linting changes.

Deactivated eslint rules have each been annotated with a # TODO
statement, so we can address them in the future. Links in the
documentation have been updated to new contributor guidelines, which
will be updated after this patch lands.

Linting may be executed by first installing npm dependencies using
`npm install`, and then executing `npm run lint` at any time in the
future. No python venv is required.

For clarification: We are switching to ESLint because JSCS explicitly
focuses on code-style, not on language use errors. For that purpose,
JSCS explicitly defers to JSHint, which due to the 'do no evil' license is
not usable. Since ESLint provides both the codestyle functionality, and
the language use checks, of both JSCS and JSHint, it was deemed the
only viable tool,

http://lists.openstack.org/pipermail/openstack-dev/2015-June/067030.html

Change-Id: Ib4c3f77f8cc3cdaa3c7558b7bc3a6d1299b6dcbe
Partially-Implements: blueprint jscs-cleanup
2015-06-30 23:00:29 -07:00
Matt Riedemann
22c485b179 Inherit environment variables for tests that use nodeenv
Tox 2.0 stopped automatically passing environment variables into the
virtual environment which potentially breaks test jobs which use nodeenv
because of the nature of running nodeenv within a virtual environment.

The nodeenv documentation (https://pypi.python.org/pypi/nodeenv) even
says:

"
If you already have the python virtualenv tool, and want to use nodeenv
and virtualenv in conjunction, then you should create (or activate) the
python virtual environment:

# in case of using virtualenv_wrapper
$ mkvirtualenv my_env

# in case of using virtualenv
$ . my_env/bin/activate
and add a node virtual environment to this existing new_venv:

$ nodeenv -p
"

Since we can't source {envdir}/bin/activate from within the tox.ini, we
just pass the environment variables into the virtual environment using
passenv = *.

An alternative may be to change run_test.sh to run tests which use
nodeenv within a venv by sourcing $VIRTUAL_ENV/bin/activate from within
run_test.sh.

Closes-Bug: #1458928

Change-Id: Icb91cdc0d4610407c4eeeda82f194c7016e3b540
2015-05-26 12:16:22 -07:00
Jenkins
f0786bdd28 Merge "Establish baseline JSCS configuration" 2015-05-01 00:45:29 +00:00
Matt Borland
97db36822e Establish baseline JSCS configuration
Establishes the ability to have JSCS (JS Code Style) run from the
run_tests.sh script.  Also provides basis for code style configuration.

Co-Authored-By: Brian Tully <brian.tully@hp.com>
Change-Id: Ib22da5ae05c353d12507a1809ec79e93379acecf
Closes-Bug: 1450626
2015-04-30 14:47:00 -06:00
Tatiana Ovchinnikova
eeba3b4b57 [Heat] Fix default values displaying for "Launch Stack"
This patch set fixes default values displaying for JSON parameters
to make it possible to use them without any changes.

Closes-Bug: #1438138

Change-Id: Ib925dc39320f7cab240eed3ccbcf1fa574bc5507
2015-03-30 14:06:23 +03:00
lin-hua-cheng
0cde6aa055 Move to hacking 0.10
Release notes:
http://git.openstack.org/cgit/openstack-dev/hacking/tag/?id=0.10.0

Per the release notes, H307, H803 and H904 has been removed.

Fix code issues with H238 and W292.

Change-Id: I747ebb64db5825bc70f1ae19c1c1f5ca2089c06d
2015-02-04 20:27:07 -08:00
Sean Dague
ee682303c3 we don't need to allow insecure any more
netaddr is up on pypi now correctly, no need to provide the insecure
flags here.

Change-Id: Ib4be1e164f8d2de3bebf42ccc4a8ac825b0f4320
2015-01-13 18:08:34 -05:00