Граф коммитов

58 Коммитов

Автор SHA1 Сообщение Дата
Kyle Lahnakoski 7f7ce81589
Support test environment outside of Docker container (#5716)
Work to support running Python tests outside of the Docker container.
This also helps with integration with IDEs and is prework for using Git hooks for precommit/prepush features.
2020-02-05 14:55:03 -05:00
Armen Zambrano deaf8c850c Bug 1169263 - Switch from Vagrant to docker-compose (#4901)
* Change permissions for docker/entrypoint.sh
* Allow using Django in localhost
* Documentation changes
Allow running shellcheck tests
Use docker-compose for the Selenium tests
Install docs updates
Switch to yarn cache instead of npm
Install UI dependencies
* Add ability to override DATABASE_URL and use a .env file
2019-05-16 14:56:02 -07:00
Ed Morley 39ba1395ff
Bug 1529243 - Update Python from 3.6 to 3.7 (#4723)
Now possible since Celery/Kombu have been updated in #4722 to version
that are compatible with Python 3.7.

Notable changes:
https://docs.python.org/3/whatsnew/3.7.html
2019-02-28 20:24:02 +00:00
dependabot[bot] 3227b2eb63 Bump isort from 4.3.4 to 4.3.8 in /requirements (#4696)
Bumps [isort](https://github.com/timothycrosley/isort) from 4.3.4 to 4.3.8.
- [Release notes](https://github.com/timothycrosley/isort/releases)
- [Changelog](https://github.com/timothycrosley/isort/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/timothycrosley/isort/commits)

And also:
* Remove no longer required isort config workarounds.
* Sort imports correctly in __init__.py (since previously isort skipped these files).
2019-02-25 11:12:40 +00:00
Ed Morley a0d1f5fccf
Bug 1330474 - Travis: Stop testing against Python 2 (#4675)
Since we've been using Python 3 in production for long enough that we're
confident we won't need to roll back to Python 2.
2019-02-25 06:54:46 +00:00
Ed Morley ecabd76f96
Bug 1453837 - Use correct value for id token expiry in auth tests (#4667)
The id token payload contains an `exp` property, which is an integer
representing the number of seconds past the epoch at which the id token
expires.

However the mocked value in our authentication tests was the string `'500'`,
which is neither the correct data type, nor a timestamp. This meant that
during tests only, the `min(accesstoken_exp_in_ms, idtoken_exp_in_ms)`
in `AuthBackend.authenticate()` was comparing an int and a string, which
under Python 3 results in:

`TypeError: '<' not supported between instances of 'str' and 'int'`

A later bug/PR will refactor the auth backend to fix issues unrelated to
Python 3 compatibility and add more test coverage.
2019-02-22 13:50:01 +00:00
Ed Morley ff2993d2fb
Bug 1330474 - Switch from Python 2.7 to Python 3.6 (#4668)
This makes Heroku/Vagrant use Python 3.6.8 instead of Python 2.7, and
inverts the versions used in the Travis testing matrix - leaving all
unit tests running against Python 2.7 to make it easier to roll back
if needs be. The Vagrant provision script and Heroku Python buildpack will
automatically detect the changed Python version and purge the existing
installation/site-packages prior to installing the new version.

We're using Python 3.6 rather than 3.7, since latest Celery/Kombu do not
yet support Python 3.7 (and we're on an older version anyway; bug 1337717).
Bug 1529243 is filed for updating to Python 3.7 later.
2019-02-21 07:38:24 +00:00
Ed Morley 3decefed0b
Clean up the location of generated output directories (#4289)
So that their purposes are clearer and it's easier to differentiate
between generated content and files committed to the repository.

* Neutrino build: `build/` -> `.build/`
* Sphinx build: `_build/` -> `.build-docs/`
* Django collectstatic: `treeherder/static/` -> `.django-static/`
2018-11-16 19:18:18 +00:00
Ed Morley 565ae4c13e
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216)
Neutrino controls our frontend linting, transpilation, source-maps,
testing, dev-server and optimisation of production builds.

Highlights of the upgrade are:

* Major version updates to the individual tools within (such as webpack,
  Babel and ESLint), significantly improving performance, fixing
  transpilation/minification correctness bugs, adding support for newer
  ECMAScript features, and increasing linter coverage.
* Hot reloading in the dev server now works for all entry-points and not
  just the jobs view, shortening the feedback cycle.
* Reduced bundle size due to webpack 4's tree shaking, scope hoisting,
  automatic shared/vendor code chunk splitting (no need for the manually
  maintained 'vendor' list).
* CSS is now extracted out of JS, which improves performance, reduces
  bundle size and prevents the initial white flash of un-styled content.
* Support for dynamic imports/code splitting (needed for bug 1502192).
* Support for Jest via a new Jest preset (unblocks bug 1364045).
* Support for public class field declarations (unblocks bug 1480166).
* Improved source-maps (increases the quality of production exception
  trace-backs and fixes several debugger breakpoint bugs).
* Reduced amount of custom configuration required for our fairly complex
  frontend needs, reducing maintenance burden and allowing for easier
  future Neutrino upgrades.

In addition this PR:

* Fixes the WhiteNoise `immutable_file_test()` regex, so that it now
  correctly enables browser caching of images, fonts and source maps.
* Enables webpack-dev-server's overlay feature, which displays any
  compilation errors in the browser, saving having to switch back
  to the console (this can be enabled for warnings too if desired).
* Enables webpack-dev-server's automatic browser-opening feature,
  which saves having to manually navigate to `localhost:5000` after
  running `yarn start`.
* Switches Karma tests to run Firefox in headless mode, reducing the
  workflow disruption when running `yarn test`.
* Uses the new webpack `performance` option to enable maximum asset
  file size thresholds, to help prevent bundle-size regressions.
* Rewrites the `package.json` script commands so that they now work
  correctly on Windows, even when setting environment variables.

Performance comparison:

* Local `yarn build`:
  - Cached: 2m34s -> 23s
  - Uncached: 2m34s -> 58s
* Local `yarn start`:
  - Cached: 34.5s -> 13.6s
  - Uncached: 34.5s -> 31.3s
* Local `yarn test`
  - Cached: 61.5s -> 19.8s
  - Uncached: 61.5s -> 22.0s
* Local `yarn lint`
  - Cached: 3.8s -> 1.8s
  - Uncached: 13.7s -> 13.4s
* Travis end-to-end time:
  9 minutes -> 6 minutes
* Heroku deploy end-to-end time:
  14 minutes -> 9 minutes
2018-11-02 18:48:28 +00:00
Ed Morley 597bb4146e
Bug 1502306 - Make it easier to run Selenium tests (#4194)
* Enables the display of skipped test/expected fail reasons, in
  the pytest summary.
* Skips the Selenium tests with a clear reason message, unless the
  built UI is found (preventing the annoying/confusing test timeouts).
* Removes the disabling of the `pytest-html` and `pytest-metadata`
  plugins, since they are required when passing the `--html` option
  to generate an HTML report.
* Updates the docs to mention `yarn build` and `--html`.
2018-10-29 17:07:38 +00:00
Ed Morley 974c9c2c5f
Bug 1502288 - Update flake8, pycodestyle and pyflakes (#4192)
* Switches from the `ignore` setting to the new `extend_ignore`, which
  doesn't overwrite the default ignore list, meaning we no longer have
  to duplicate it ourselves.
* Remove the rarely used `[pycodestyle]` config section, since it's
  only used when using tools like autopep8, which should really learn
  to use the `[flake8]` section themselves.
* Enables the previously ignored F403 and F405 rules, adding `# noqa`
  entries to instances that we do not wish to fix.
* Adjust max line length down to 100, since we already disable the
  `E501: line too long` rule, making the length mostly redundant
  other than in IDEs, where it's probably good to show a warning if
  exceeding 100 characters.
* Fixes:
```
treeherder/intermittents_commenter/commenter.py:202:10:
  W605 invalid escape sequence '\['
treeherder/intermittents_commenter/commenter.py:202:24:
  W605 invalid escape sequence '\]'
treeherder/webapp/graphql/schema.py:7:1:
  F403 'from treeherder.model.models import *' used; unable to detect undefined names
```

Closes #4177.
Refs #3425.
Refs #3565.
2018-10-29 09:44:34 +00:00
Cameron Dawson d98f2a3d27 Revert "Bug 1492270 - Convert list of pinned jobs to a Context"
This reverts commit 8aae70a82c.
2018-09-19 17:04:58 -07:00
Cameron Dawson 8aae70a82c Bug 1492270 - Convert list of pinned jobs to a Context 2018-09-19 16:02:24 -07:00
pyup.io bot 718a2cd527 Update pytest-selenium to 1.14.0 (#3947)
And remove the now redundant filterwarnings entry, since that warning
has now been fixed.
2018-08-24 12:53:18 +01:00
Ed Morley 67d09d55d8 Bug 1483051 - Update to whitenoise 4
* Renames `is_immutable_file` to match changes to the parent class.
* Suppresses the new "missing static files directory" warning when
  running the tests (since it's expected in !production).
* Uses the new `extras_require` `[brotli]` entry to make WhiteNoise's
  dependency more obvious.

Changelog:
http://whitenoise.evans.io/en/stable/changelog.html#v4-0

Closes #3903.
2018-08-14 14:19:31 +02:00
pyup.io bot 8ee5bf23a4 Update pypom to 2.1.0 (#3914)
And remove the now fixed `filterwarnings` entry.
2018-08-14 13:57:41 +02:00
pyup.io bot ac81dba055 Update selenium to 3.14.0 (#3872)
And add a `filterwarnings` entry for new selenium `DeprecationWarning`.
2018-08-12 04:25:58 +02:00
Ed Morley a2da8d08ca
Bug 1466084 - Docs: Install recommonmark as an editable dependency (#3847)
Since Read The Docs has a pre-installed older version installed,
and doesn't use `--upgrade` with pip, so we have to force the latest
version to be installed by using "editable" (`-e`) mode:
https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support

This fixes the exception that occurred on Read the Docs (but wasn't
seen on Travis, since it doesn't have the pre-installed older version).
2018-07-30 21:44:38 +02:00
pyup.io bot 08026c0ffc Update pluggy to 0.7.1 (#3842)
And add a `filterwarnings` entry for new pluggy `DeprecationWarning`.
2018-07-29 15:21:32 +02:00
George Hickman 8c47b6e53b isort: Explicitly set tests directory as first party (#3782) 2018-07-12 16:41:18 +01:00
Ed Morley efcff8e586
Remove fixed deprecation warning from filterwarnings (#3761)
Since the pytest-django update in #3672 included the fix for:
https://github.com/pytest-dev/pytest-django/issues/596
2018-07-05 11:46:18 +01:00
pyup.io bot 6cd67c2729 Update pytest to 3.6.0 (#3572)
* Update pytest from 3.5.1 to 3.6.0
* Add new atomicwrites dependency
* Ignore deprecation warnings triggered by pytest-django
2018-05-29 11:35:59 +01:00
Dave Hunt e63ff9d8bd Migrate test_get_next_results to Travis suite 2018-04-18 13:28:13 +01:00
Ed Morley 023d31885a
Bug 1453850 - Enable Python 2's `-3` mode on Travis (#3444)
This enables `DeprecationWarnings` for things that Python 2 knows
are not compatible with Python 3. The `error` entry in the pytest
`filterwarnings` setting ensures these will be surfaced as Exceptions
and so result in test failures.

See:
https://docs.python.org/2/using/cmdline.html#cmdoption-3

The removal of `sorted()` from `test_bug_job_map_api.py` is to fix:
`DeprecationWarning: dict inequality comparisons not supported in 3.x`
2018-04-13 23:14:36 +01:00
Ed Morley 2800a878b7
Bug 1389517 - Remove usages of deprecated pypom .selenium property (#3441)
Fixes:
`pypom/view.py:21: DeprecationWarning: use driver instead`
2018-04-12 15:27:48 +01:00
Ed Morley 36f0a71e03 Bug 1389517 - Make Python warnings fatal during pytest runs
This makes most warning types (including the normally hidden
`DeprecatonWarning`s) fatal during pytest runs, to help prevent
regressions now that most of them have been fixed.

See:
https://docs.pytest.org/en/latest/warnings.html
https://docs.python.org/2.7/library/warnings.html#warning-categories
2018-04-11 21:11:57 +01:00
pyup.io bot 9c9a82a56e Update isort from 4.2.15 to 4.3.4 (#3217) 2018-02-12 15:45:42 +00:00
Dave Hunt d659d0dbec
Migrate test_switch_repo to Travis suite (#2956) 2017-11-17 09:48:05 +00:00
Dave Hunt 9fd3c72241
Bug 1340305 - Allow Selenium tests to be run locally 2017-11-09 12:55:25 +00:00
Ed Morley 204b2ea49a Bug 1378118 - Disable unused auto-loaded pytest plugins
This stops the broken mozlog plugin being loaded, which was preventing
us updating to newer pytest. Other unused plugins have also been
disabled, to avoid future issues and improve pytest load times.
2017-07-04 14:18:13 +01:00
Ed Morley de0f8d7f47 Bug 1370279 - Improve pytest test collection performance
Before this change running pytest with no arguments took 51 seconds
to just collect the list of tests to run (`pytest --collect-only`),
since the entire source directory was scanned (including the 18,000
files in `node_modules`).

Now it takes only 3.7 seconds.
2017-06-05 17:57:48 +01:00
Ed Morley 64583c1924 Bug 1370279 - Prevent conflicts with jenkins pytest configuration
This fixes the `ConftestImportFailure` exception seen when trying
to run pytest in Vagrant after bug 1286686 landed.
2017-06-05 17:57:48 +01:00
Ed Morley da7f1bdc7d Bug 1370279 - Move pytest configuration to setup.cfg
Since it keeps everything test/lint/tool related in one place, so
easier to keep ignore paths in sync and less repo clutter.
2017-06-05 17:57:48 +01:00
Rebecca Billings 1d1f651ce4 Bug 1286686 - Import Selenium tests from treeherder-tests repo (#2302)
Initially these will continue to be run in Jenkins, however later they
will be converted to run on Travis along with the existing local
Selenium tests.
2017-05-16 23:27:45 +01:00
Ed Morley c1dfddc5f6 Bug 1348375 - Re-enable flake8 rule F401
Since it's actually needed to catch unused imports, albeit it's a bit
more strict than it used to be, so required some fix-ups before it could
be re-enabled.
2017-03-20 13:18:21 +00:00
Ed Morley f91611f646 Bug 1334329 - Stop ignoring linter errors in migration files
Now that we're on Django 1.10 (which doesn't add unused imports) and the
old migrations have been removed we no longer need to ignore them and
risk hiding real breakage.
2017-02-27 17:14:50 +00:00
James Graham 067aad46bd Bug 1337726 - Disable E129 pyflakes lint.
This demands a weird style when using
if (something and
    something_else):

which is not really helpful to code readability.
2017-02-10 00:21:10 +00:00
Ed Morley 0f20ff2569 Bug 1333092 - Update to newer flake8, pycodestyle (pep8) & pyflakes
flake8 has been updated to support the newer versions of pycodestyle
(formerly named pep8) and pyflakes. Some of the new checks are too noisy
so have been added to the ignore list.

Changes:

http://flake8.pycqa.org/en/latest/release-notes/index.html
https://gitlab.com/pycqa/flake8/compare/2.5.4...3.2.1

https://github.com/PyCQA/pycodestyle/blob/master/CHANGES.txt
https://github.com/PyCQA/pycodestyle/compare/1.5.7...2.2.0

https://github.com/PyCQA/pyflakes/blob/master/NEWS.txt
https://github.com/PyCQA/pyflakes/compare/1.0.0...1.3.0

https://github.com/PyCQA/mccabe/blob/master/README.rst#changes
https://github.com/PyCQA/mccabe/compare/0.4.0...0.5.3
2017-01-23 16:30:25 +00:00
Ed Morley 80dd4cf2ec Bug 1333092 - Fix flake8 E402: module level import not at top of file
treeherder/config/wsgi.py:17:1: E402 module level import not at top of file
treeherder/config/wsgi.py:18:1: E402 module level import not at top of file
2017-01-23 16:30:25 +00:00
Ed Morley 7cce7b2fa7 Bug 1308354 - Remove SCL3-specific code now we're on Heroku 2016-10-24 18:55:03 +01:00
William Lachance 2b150f36bf Make flake8/pep8 ignore perf migrations as well 2016-04-04 11:12:34 -04:00
James Graham 99bd93c4f6 Don't run pylint in the migrations directory 2016-03-22 17:04:33 +00:00
Ed Morley b2ecb99390 Bug 1213230 - Remove peep.py
Since it's now unused.
2016-02-15 12:06:17 +00:00
Ed Morley 1e599b6681 Bug 1192957 - Add config for isort
It can now be run with just `isort` and will do the right thing.

The chosen multi-class import style is:

from third_party import (lib1,
                         lib2,
                         lib3
                         ...)

See the docs added in a later commit, or:
https://github.com/timothycrosley/isort/blob/develop/README.rst
https://github.com/timothycrosley/isort/wiki/isort-Settings
2015-10-02 17:54:48 +01:00
James Graham 525f5912e8 Bug 1201852 - Allow E125 and E129 errors in pyflakes.
These forbid common constructs, notably
if (foo and
    bar):

which has no basis in PEP8 or sanity. In modern pyflakes only E129 would have to be permitted
but Ubuntu 14.04 has an older version which lumps this in with some other cases in E125.
2015-09-15 19:01:47 +01:00
Ed Morley 90ba77e596 Bug 1192801 - Remove per-file MPL boilerplate since it's unnecessary
The MPL 2.0 terms state that as long as a LICENSE file is present, the
per-file header text is not required. See "Exhibit A" at the end of:
https://www.mozilla.org/MPL/2.0/
2015-08-18 23:32:11 +01:00
Ed Morley b4720652d6 Bug 1181529 - Update peep to v2.4.1
* Tolerates `pip.__version__` being missing, which can happen in arcane
  situations during error handling, obscuring informative tracebacks.
* flake8 warnings are fixed again, so peep.py can be removed from the
  exclude list.

https://github.com/erikrose/peep/releases/tag/2.4.1
https://github.com/erikrose/peep/compare/2.4...2.4.1
2015-07-08 12:39:30 +01:00
Ed Morley 58813b0c51 Bug 1169916 - Stop using Cython to build the log parser
Since it only speeds up parsing by a few percent of total runtime, and
is therefore not worth the added complexity for deployment and local
hack-test-debug cycles when working on the log parser.

The .gitignore and update.py entries will be removed in a later commit,
once the stage/prod src directories have been cleaned up.
2015-06-30 14:51:57 +01:00
Ed Morley acbc0b6d36 Bug 1169915 - flake8/pep8: Check *.pyx files too
flake8/pep8 default to just checking *.py, but we have Cython .pyx files
in treeherder/log_parser/.
2015-05-30 13:52:05 +01:00
Ed Morley be4c2b5d04 Bug 1166901 - Exclude the node_modules directory from flake8/pep8 2015-05-27 22:18:23 +01:00