Commit Graph

153 Commits

Author SHA1 Message Date
Rob Cresswell 6529cd1eb8 Remove run_tests.sh
Change-Id: I9892b6c07c6392e534aad0391722727c7ca3e879
2017-08-15 10:38:19 +00:00
Tony Breeds a909ed26c2 Add constraints support to run_tests.sh
Currently developers need to manually build a constratined venv if they
want to  match the versions that are tested in the gate.  This change
adds logic to run_tests.sh and install_venv*.py to default to the same
constraints file used in the gate.

With constraints enabled the 'churn' in the environment should be
minimised so remove the developer optimisation for detecting when
packaged versions change and always just install/update.  This has the
down side of making the script preamble slightly longer but we always
print_help() so I don't think it'll be terribly inconvenient.

Change-Id: I9bf85adb5aa2c85d8c0f0f22ac9efe5cac3646c0
Closes-Bug: 1644697
2016-11-28 11:06:07 +11:00
Rob Cresswell f390c4a897 Add deprecation message to run_tests.sh
We should finally get rid of run_tests and just move to tox. Adds a
deprecation warning to give this change more visibility.

Change-Id: I4cfd8f031e49ae302ceee18496cc68bcec42c821
Implements: blueprint enhance-tox
2016-10-04 14:27:12 +01:00
Andreas Jaeger 005474377e Fix translation test
We do not store pot files anymore in git. Fix run_tests.sh that expects
that these are in git. To restore normal content, just remove the
generated files.

Change-Id: Ief0861e01ff758120001f4c8dfdbf9afadf09f5b
2016-05-07 10:36:05 +02:00
Akihiro Motoki b903a380b5 Sync paths in POT files with CI scripts
The infra scripts which handle translation support for horizon
was recently changed to remove horizon special handling.
As a result, file paths in POT files now contains module names
(openstack_dashboard or horizon).

This commit update pybabel related functions in run_tests.sh
so that even when we run ./run_tests.sh --makemessages in
local env POT files are not changed unexpectedly.

Change-Id: I32e83244e7fa3a4f6039573a97f1b0dca9fdd4c8
2016-03-11 11:40:34 +01:00
Akihiro Motoki ce6e34a5e4 Honor comments for translators when extracting messages
To extract commments for translators, '--add-comments' option
must be passed to pybabel. Comments for translators were extracted
when we used Django tools to extract messages, but when we switched
to pybabel it was lost. This commit adds the option to run_tests.sh.

Move the place of existing comments for translators
so that pybabel can find them. Django tool and pybabel
expect a bit different places.
Also add comments to ungettext_lazy in test codes.

Closes-Bug: #1553581
Change-Id: Ia2df36dfebb59bede19d57b2158a907126ca1944
2016-03-07 23:11:39 +09:00
Richard Jones a17612ed97 Merge the two webdrivers
Horizon currently has two webdrivers for selenium-based
testing; this patch merges them into one so all tests
(selenium functional tests and integration tests) benefit
from improvements we make to the webdriver.

Change-Id: Iac471c2c7e40c799711746ef9e3e4ef87aecf098
2016-01-30 11:54:19 +00:00
Richard Jones 861f9c2c4a Enable PhantomJS for running Selenium tests
This patch enables the PhantomJS webdriver for running
the Selenium test suite.

Use it with the --selenium-phantomjs command-line switch
when executing the selenium and integration suite.

Change-Id: I443e6f6d7d1911df500b360f7c22686b417fbeae
Blueprint: enable-phantomjs-selenium
2015-11-25 11:25:51 +11:00
Thai Tran 44779ef070 Duplicate keywords for translation
There is a duplicated keyword in the list of keywords specified for
translation. This is incorrect and should be ugettext_noop.

Change-Id: Ie8b5b91255412cb6615e758a4c5615bee9989b4f
Closes-Bug: #1472385
2015-07-07 13:07:24 -07:00
Jenkins 17342c2d42 Merge "Angular translation via babel (singular only)" 2015-07-02 22:44:34 +00:00
Neill Cox 9b36822fe2 Angular translation via babel (singular only)
An approach to i18n for Angular HTML templates using babel. This patch
allows only singular translation. Plurals and context will be
addressed in subsequent patches.

Based on Thai Tran's work at https://review.openstack.org/#/c/187321

This patch implements a custom extractor in
horizon/utils/babel_extract_angular.py. pybabel really wants this to be
a package installed into site-packages. I have not done this so as to
avoid introducing a dependency on another change to global requirements
just yet. I will upload a package to pypi in parallel so that we can
start using it in the future.

For now, I have had to modify tools/with_venv.sh to add horizon to the
PYTHONPATH. This is less than ideal but seemed to be the least worst
option.

Steps to verify that it works:
1. Create a new html file in horizon/static or openstack_dashboard/static
2. Add something like <div translate>hello world!</div> to the html
   To test interpolation add something like:
     <div translate>hello {$name$}!</div>
3. Run ./run_tests.sh --makemessages
4. Inspect your djangojs.po file, it should be there.

The following steps are optional:
5. Run ./run_tests.sh --pseudo de
6. Run ./run_tests.sh --compilemessages
7. Go to http://localhost:8000/settings
8. Change Language to Deutsch
9. Go to http://localhost:8000/i18n/js/horizon+openstack_dashboard
10. Your translated text should be there as well.

Note: There are now unit tests as well.

Partially-Implements: blueprint angular-translate-makemessages
Depends on: If4352aba01ce0ca6337f590c0689d8fe9f0867c8

Change-Id: I26d4fef8646d5f038918cd3376dbbdbef37eb603
2015-07-02 11:13:45 +10: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
Andreas Jaeger 3bfca35194 Remove now obsolete English po files, update run_tests
These English po files are not needed anymore, they are the source files.

Update run_tests.sh to use the .pot files as source for generation of
pseudos.

Update transifex config file so that it references the new pot files.

Depends-On: Ibd7069c68e458d655a879e552f69f7146b47abc9
Change-Id: I6c6989176fd7c969ad6cb4ecb4ff4f5e4641e723
2015-06-22 20:17:55 +02:00
Andreas Jaeger 1f1a013d43 Use *.pot files for source language
All other OpenStack projects use *.pot files for the source language.
In the OpenStack CI scripts, we need to special case horizon since
it uses */locale/en/LC_MESSAGES/*po instead. Remove the special handling
from the horizon scripts so that we can simplify the CI scripts.

Note that this simplifies also the run_tests.sh script.

Add empty files for the pot files so that the infra scripts will work.
The next import from the Proposol Bot will add real content for these
files.

Change-Id: I2ae68207994ba549b5d8e551a40a468d63e0a4bb
2015-06-22 19:29:24 +02:00
Neill Cox 4e0b09a357 Replace makemessages with babel
Replace django's makemessages with babel and babel-django.

This changes the makemessages command to use babel rather than
Django's builtin makemessages.

There is a follow on patch to add support for angular-gettext.

Change-Id: If4352aba01ce0ca6337f590c0689d8fe9f0867c8
Depends-On: Iaa835b03af3929b7314b174210079c34de976755
2015-06-22 09:44:12 -07:00
Matt Borland 241c2cf432 Get unit tests working with Karma
Establish features for running Karma tests.  Separate karma configurations
are used due to current overlap of template file structure.

You can run the karma tests via:
  ./run_tests.sh --karma

The Karma framework allows for many features like unit test coverage and
provides a common configuration for different test runners.

Change-Id: I79680ef6369383c148da68e6677945886a48df81
Implements: blueprint karma
2015-06-01 14:14:58 +00:00
Tyr Johanson d1bdc0ae7d ngReorg - create framework dir
This patch simply renames:
  horizon/horizon/static/angular
to:
  horizon/horizon/static/framework

This is one step in a larger effort to restructure the Angular
source. See https://review.openstack.org/#/c/176152/ for the
full set of planned changes.

Partial-Bug: 1454880
Change-Id: I2bbcc64caa42f97c7d92688f4c5d7915146966bc
2015-05-13 17:43:42 -06:00
Thai Tran 96130205fc Fixed dashboard angular translation issue
We now have javascript files in openstack_dashboard as well. However,
the run_test script does not account for this and only run translation on
the horizon folder. This patch address this problem. Also removed the
invalid gettext('') since that causes the msgid to be blank.

Steps to test:
1. ./run_tests.sh --makemessages
2. ./run_tests.sh --pseudo de
3. ./run_tests.sh --compilemessages
4. set LAUNCH_INSTANCE_NG_ENABLED = True in local_settings.py
5. localhost:8001/settings/ and change to deutsch
6. localhost:port/project/instances/ and click on launch instance

Co-Authored-By: Doug Fish <drfish@us.ibm.com>
Change-Id: If1cd1937d40d359a4a4ecd75406f62e8f8802082
Closes-bug: #1444150
2015-05-05 11:32:33 -07:00
Matt Borland 5f60007283 Fix missing default value for JSCS var in run_tests.sh
Adds default value so ./run_tests.sh without --jscs doesn't produce warning.

Change-Id: I1f68e9c9dc22f8f1279532fd4aae6919e63abd80
Closes-Bug: 1450799
2015-05-01 08:10:21 -06: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
Matthias Runge 0c7b3200d0 run compilemessages with runtime deps
this fixes the issue compilemessages requires test deps.

Partially Implements: blueprint django18

Change-Id: Id942450a02d0df565170b84f2aff0566e0ef1952
2015-03-25 19:12:14 +01:00
Shaoquan Chen 6f1eec9ca7 Base launch instance wizard
- Setting up base launch instance wizard to enable parallel
  development on steps in the work flow.
- Adding business logic related code to openstack_dashboard
  project.
- Using Horizon's well-defined plug-in architecture to hook
  launch instance to Horizon.

Partially Implements: blueprint launch-instance-redesign
Change-Id: Ibbbbfc7f49c58a78b0d1b29e363531d5ae1a9aab
2015-02-19 14:39:52 -08:00
Shaoquan Chen 46b6a3b047 Improving jshint
- Including JS files under horizon/static/angular/ folder.
- Adding .jshintrc to allow globals defined by jQuery, Angular,
  Angular mock, Jasmine, d3 and jsi18n.
- Allowing global strict mode in spec files.

Change-Id: I07359a4b3044cd5f675eef3b7df99398df909f81
Closes-Bug: #1419625
2015-02-13 13:19:56 -08:00
Doug Fish faae8b86fa Pseudo translation tool
A tool to allow pseudo translations to be created in order to identify
potential translation problems. To use the tool:
Make sure your English file is up to date:
./run_tests.sh --makemessages

Run the pseudo tool to create pseudo translations:
./run_tests.sh --pseudo de

Compile the catalog:
./run_tests.sh --compilemessages

Run your dev server. Log in and change to the language you pseudo translated.
It should look weird. More specifically, every translatable string is going
to start and end with a bracket and they are going to have some added
characters. For example, "Log In" will become "[~Log In~您好яшçあ]"
This is useful because you can inspect for the following:
- If you see a string in English it's not translatable. Should it be?
- If you see brackets next to each other that might be concatenation.
- If there is unexpected wrapping/truncation there might not be enough
  space for translations
- If you see a string in the proper translated language, it comes from an
  external source. (That's not bad, just sometimes useful to know)
- If you get new crashes, there is probably a bug. :-)

Implements blueprint: pseudo-translation-tool

Change-Id: If97754c2d4234b12b3d73616ff60527f6ad82d55
2015-01-20 13:08:26 -06:00
Akihiro Motoki 0da0ea1438 Determine environment version based requirement files
It is painful to increment the venv version manually because
requirements.txt and test-requirements.txt are now updated by cron job.
This commit changes run_tests.sh to just store two requirements
files to .venv/environments file and check if it is up-to-date.
(Note that the environment cache file is moved to .venv directory
as there is no reason to store it in the top directory.)

Closes-Bug: #1376485
Change-Id: Ie44ccf6e2e65890baca3f316468254b600c518b1
2014-10-24 02:08:17 +09:00
Akihiro Motoki b6857b5fa7 Add check for makemessages in tox.ini PEP8
This commit adds a check of extracting message catalogs to
tox PEP8 check. It is useful to avoid a bug like bug 1379054.

It also fixes a warning "WARNING:root:No local_settings file found."
in run_tests.sh --makemessages and --compilemessages by specifying
Django settings.

Closes-Bug: #1379507

Change-Id: I5541e28a87d48601202bf8180a18eadb5a91770b
2014-10-10 05:38:53 +09:00
Radomir Dopieralski 9e37a00ee9 Unbundle bootstrap and use xstatic version
This uses the xstatic-packaged versions of bootstrap and bootstrap-datepicker.
It requires newer versions of pyscss and django-pyscss, as there were some
bugs in there that were just fixed upstream.

Change-Id: I0a7660d29fecde915eb46916453a9ea96296798d
Implements: bluperint remove-javascript-bundling
Closes-bug: #1375883
2014-09-30 18:46:47 +02:00
Randy Bertram 6849481c42 Switch to xstatic-bootstrap-datepicker
This points to datepicker 1.3.1 in xstatic.
Also fixes a couple of minor bugs in forms with
the new datepicker. The datepicker patch is:
https://review.openstack.org/#/c/116866/

Change-Id: I0a8cb7a16e50addbbdb10df8bdd4be427937bd81
Closes-Bug: 1361666
2014-09-11 13:26:11 -04:00
David Lyle 87d4f0ae00 Updating the environment version
Recent requirements updates have not been reflected in the
environment version.

Change-Id: Icaf4a3260725e6229bc174b72e5a2feeb8fe4cdf
Closes-Bug: #1365107
2014-09-03 13:01:16 -06:00
Jenkins 558a775282 Merge "Provide a quick way to run flake8" 2014-08-25 07:52:25 +00:00
Akihiro Motoki e63ff5eab0 Provide a quick way to run flake8
"run_tests.sh -p" always checks every file for errors even though you
have probably only changed a handful. This patch adds "run_tests.sh -8"
which only checks the files that were modified in the HEAD commit or
the current working tree.

It is borrowed from the recent nova commit b011325cc6.
The related ML post is:
http://lists.openstack.org/pipermail/openstack-dev/2014-August/043346.html

Change-Id: If3c8e5e3e442257f796374edba02c3a23a85839e
2014-08-24 07:34:53 +09:00
Radomir Dopieralski 210717a43d Unbundle all JavaScript libraries from Horizon
Remove all external JS libraries from Horizon, and pull them in as
xstatic packages instead.

Bootstrap, jquery-ui and jquery.bootstrap.wizard will be unbundled in separate
patches, as there are some problems adding them to global-requirements.

Partial-Implements: blueprint remove-javascript-bundling
Change-Id: Icbbcf8e58db2dcce96d187f7307201f728812cd2
2014-08-19 09:59:12 +02:00
Jenkins 75a5f5f1f9 Merge "Add CLI option for running Selenium tests headless" 2014-06-30 21:11:10 +00:00
Jenkins 3e9ba4f376 Merge "Add jshint for javascript linting" 2014-06-30 07:13:27 +00:00
Peter Belanyi 0a83ae972e Add jshint for javascript linting
Added nodeenv as a test requirement.

Added a jshint environment to tox.ini, which installs node.js into the
python virtual environment with nodeenv, installs jshint using npm,
and calls runtest.sh to run the tests.

runtest.sh now supports the -j|--jshint flags to run jshint on the
javascript files. jshint must be installed before running runtest.sh

The documentation also got updated to include some info about jshint.

This patch does not add jshint to the OpenStack codebase, just provides
a way to install it for testing, to avoid license clash (jshint has a
slightly modified MIT license, which is incompatible with OpenStack's
Apache license).

Change-Id: I9dd0743eaee50fdba3dbb527c29f2501bdd44ca6
Implements: blueprint node-toolchain
Implements: blueprint jshint-codestyle
2014-06-26 14:00:45 +02:00
Julie Pichon 84bff9724d Allow running a subset of the integration tests
This follows the same syntax as a running a subset of the unit tests.

Change-Id: I36dfa8280b8fc63e7b650dfce6dbb0df26e73852
Closes-Bug: #1333774
2014-06-24 16:55:19 +01:00
Gary W. Smith 1f38f87138 Fix keystone warnings while building docs
When building the documentation via run_tests.sh, doc/source/conf.py
explicitly sets the DJANGO_SETTINGS_MODULE environment variable,
overriding any existing value that it already has. Furthermore, it sets
it to point to a settings file that does not use keystone v3, which
is expected by the tests (and is the source of the warning).  Note that
when running unit tests via run_tests.sh, a different settings file is
supplied which DOES use keystone v3.

Change the doc/source/conf.py to only set DJANGO_SETTINGS_MODULE if it
is not already set.  Change tox.ini and run_tests.sh to set
DJANGO_SETTINGS_MODULE to the same settings file used by the unit tests,
with keystone v3 support.

Change-Id: Ib297e4188f2426cf575300998bc9d50f36e48f4f
Closes-Bug: #1257725
2014-06-16 15:42:18 -07:00
marianitadn 44055c1676 Add CLI option for running Selenium tests headless
- Add requirement for xfvbwrapper
- Add CLI option for running tests headless
- Update Selenium TestCase to start virtual display if the option is set
- Update documentation about running Selenium tests

Change-Id: Icb1ac3491b8eef6c168bf1421cf073da67600982
Closes-Bug: #1290329
2014-06-05 15:44:04 +03:00
Jenkins 3722a614a9 Merge "Add tox env to build docs" 2014-04-18 21:27:50 +00:00
Maxime Vidori d2d2e5b6a1 Use "python -m coverage" rather than use "coverage" explicitly
When coverage module is installed using a package from Debian/Ubuntu,
the command name is "python-coverage". By using "python -m coverage"
the coverage module is detected in both cases.

Change-Id: Icf9084855b83d0cc721de5325f38cf72ac85ff81
Closes-Bug: #1241332
Co-Authored-By: florent <florent.flament-ext@cloudwatt.com>
2014-04-09 18:38:05 +02:00
Akihiro Motoki c4146c4016 Add tox env to build docs
In django-based projects, we need to specify DJANGO_SETTINGS_MODULE
when running docs build. It is required to addresses the warnings of
docs build job in the gate.

This commit also changes run_tests.sh --docs to use "python setup.py
build_sphinx" to match tox docs env. This change addresses all sphinx
build warning except keystone v3 related following warning.
I believe it is useful.
  NoReverseMatch: u'domains' is not a registered namespace
  inside 'horizon:admin'

Closes-Bug: #1302532
Related-Bug: #1257725

Change-Id: I3663b81b58be3c6cb05e4af914f768c28b21ea07
2014-04-05 03:13:27 +09:00
Jenkins bbd59bf5c6 Merge "Remove English compiled catalogs after compilemessages" 2014-03-27 20:15:36 +00:00
Akihiro Motoki c3a6c79ebb Remove English compiled catalogs after compilemessages
./run_tests.sh --compilemessages compiles all languages including
English, but English is the source language and there is no need
to have compiled message catalogs for English.

Also this commit update the description of --makemessages.

Change-Id: I30cf4336cc796e8e3bea71120b6c75ce40aaf888
Closes-Bug: #1261290
2014-03-25 22:27:55 +09:00
Akihiro Motoki a5a0544ee2 Make makemessage ignore option work with Django 1.6
In run_tests.sh --makemessages, files under openstack/common are excluded
and "--ignore=openstack/common" option to manage.py makemessages is used
to exclude these files. However, after the default version of Django is
switched to 1.6, "--ignore" option works does not work as previously it
does and strings from openstack/common are included in translation strings.

The reason of this is that ignore pattern is checked against basename of
each file/directory in Django 1.6. We need to specify basename in ignore
patterns: i.e. --ignore=openstack. At now we don't have directories named
as "openstack" other than openstack_dashboard/openstack/common, so it works.

This works both with Django 1.6 and 1.5.

Change-Id: I547be679c2f4ce49bd439b8f629e8720eebdb896
Closes-Bug: #1295920
2014-03-22 10:59:20 +09:00
Matthias Runge 0ed2b04186 Fix selenium imports on tests
tests require selenium to be installed, no matter if
integration tests or selenium tests are executed or
not.

Change-Id: Ie55d64c19b00b5b22f62948d4a24a3f322082b0c
Closes-Bug: #1289270
2014-03-12 09:52:08 +01:00
Julie Pichon b4b0e1a887 Integration tests - running the tests
Initial setup for running the integration tests. A basic test is
included to ensure this works, although it will be rewritten to follow
the Page Object pattern. Thanks to Daniel Korn for the initial test.

https://wiki.openstack.org/wiki/Horizon/Testing/UI

Implements blueprint: selenium-integration-testing

Change-Id: Id5b62cdeac5295667a3922f7bed1db3c7617f841
2014-02-26 10:45:21 +00:00
meena 6d07991a58 Typo corrections in run_tests.sh comments
Change-Id: I7d247bada06b38884970c1187a51357ab76a8952
2014-02-19 23:09:18 +00:00
Akihiro Motoki c41db6588f Speed up unit tests without coverage
Previously coverage command is always used even if coverage is
not enabled and this makes unit tests slower.

Change-Id: I4311164ef907fbdc66ac66d4999b25054bc9eebd
Closes-Bug: #1272979
2014-01-27 05:11:17 +09:00
Ana Krivokapic c49fcd3bd9 Make running of unit tests more robust
Unit tests would fail if run from a symlinked directory.
To fix this, this patch adds the -P switch to the pwd command,
to make sure all files are referred to by their actual paths
and not symlinks.

Change-Id: Ib7087c11f9dc2c44be3aca8cf94db227a2db72f3
Closes-Bug: #1266220
2014-01-05 17:03:43 +01:00