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

71 Коммитов

Автор SHA1 Сообщение Дата
Sebastian Hengst b61c50c24c
Ignore warning RemovedInDjango41Warning to let pytest run in local development environment (#7517)
The django-extensions package sets 'default_app_config' wrapped in a 'try'
statement.
2022-08-19 10:53:49 -07:00
Bastien Abadie 6c56b6cd64 Update references to Python 3.9 2022-06-02 15:48:06 +02:00
Bastien Abadie 68596acba4
Bump to python 3.8 (#7438)
* Bump to python 3.8

* Avoid RuntimeError: dictionary keys changed during iteration

* Fix hanging test_tracker_updates_records_with_missing_data

* Disable pytest warning on on Unraisable exceptions
2022-05-16 11:30:31 -07:00
Ben Hearsum (he/him) dd0216ae40
Re-re-re-remove activedata and bigquery (#7056)
* Bump python to 3.7.10 to try to fix issues with typing module

* Remove requirement on typing again

* Remove bigquery and activedata references (#7051)

* Remove activedata and bigquery again

* Add importlib-metadata to dev requirements

* Remove remnants of selenium tests from setup.cfg

* Don't call taskcluster.aio.createSession outside of async functions (it's not allowed)

* Disable newrelic linters to fix issue with imp module

See https://discuss.newrelic.com/t/python-warnings-during-pytest/114897

* Fix linting errors

* Use pytest-xdist to speed up tests

* Properly ignore newrelic warnings

* Disable django.contrib.staticfiles in tests, because it breaks everything

* Set TREEHERDER_DEBUG=False for unit tests, because it breaks some tests

* Fix linting issues
2021-03-23 09:15:32 -04:00
Cameron Dawson 9908f72189
Bug 1576966 - Convert last Selenium tests to React Testing Library (#6928) 2020-12-21 12:54:07 -08:00
Armen Zambrano 368c112266
Apply black formating to the whole repo (#6332)
* Automatic black fixes
* Add conflicting rule exceptions between black and flake8
2020-04-21 10:35:59 -04:00
Kyle Lahnakoski 53a806d3cc
Test integrate black (#6277)
* Configuration for black

* changes congiguration

* change pyproject's directory

* add files to be excluded and skip string normalization

* removed isort from pre-commit

* remove version locks for black

* fix

* remove all isort

* update requirements

Co-authored-by: SuyashSalampuria <suyash546@gmail.com>
Co-authored-by: Kyle Lahnakoski <kyle@lahnakoski.com>
2020-04-08 14:47:37 -04:00
Cameron Dawson a31426bce0
Bug 1611334 - Remove support for GraphQL (#6235)
Co-authored-by: Kyle Lahnakoski <kyle@lahnakoski.com>
2020-04-07 17:36:57 -04:00
Kyle Lahnakoski e60d301775
Reduce list of Python requirements (#6141)
This is a shortened and easier list of packages to manage.

Co-authored-by: Kyle Lahnakoski <kyle@lahnakoski.com>
2020-04-07 14:40:36 -04:00
Shubhank Saxena c7f9fbb5de
Add seed-isort-config hook (#6182) 2020-04-07 08:14:36 -04:00
Kyle Lahnakoski ebf67a67c3
Update hashes, fix docker isort, more docs (#6199)
* reference

* update requirements

* fix constants

* disable isort in docker
instructions on running tests
remove timezone info

* more doc fixes

* more cleaning instructions

* fix isort

* more docs

* whitespace

Co-authored-by: Kyle Lahnakoski <kyle@lahnakoski.com>
2020-03-30 15:40:42 -04:00
Armen Zambrano a3a50d4ccd
Travis: Run Python tests outside of Docker container (#5943)
* Add Travis job to run Python tests outside of Docker
* `runtests.sh` is renamed to `runchecks.sh` and it does not run Python tests
* `manage.py check --deploy` was duplicated in Travis
* Update testing documentation
* Remove `-bb` since it is not needed since Python 3.5
2020-03-20 14:58:11 -04:00
Kyle Lahnakoski 5cdff375ec
isort to ignore all directories that start with dot (#5992) 2020-02-12 14:45:46 -05:00
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