Commit graph

115 commits

Author SHA1 Message Date
Ankush Menat
bbcc365a24
fix: use monotonic clock for timing code (#19138)
* fix: use monotonic time for timing code

`time.time()` depends on system clock which can drift away and get corrected
over time. If you're unlucky it will get corrected in your timing code
and give absurd results.

* test: dont check for status

can refresh and give wrong output

[skip ci]
2022-12-06 15:42:37 +05:30
Ankush Menat
032df946be
test: bg jobs test cleanup (#18767)
* test: fix flaky RQ job tests

Sometimes stop_job doesn't succeed and causes tests to timeout. Reduced
sleep time to avoid this in tests. We are still testing all the
important features - monitoring.

* build(deps): Bump RQ to latest version

Minor bugfixes that affect us

ref: https://github.com/rq/rq/releases

* test: sanity tests for scheduled job types

* test(test_runner): dont set bench_id globally

* refactor: stop_job shouldn't throw error

The intention of use here is to stop stuck jobs or long running jobs, if
for some reason they were stopped by the time command gets executed,
there's no need to throw error.
2022-11-05 14:08:35 +05:30
Ankush Menat
3ec4a618e3
test: FrappeClient tests not skipped (#17843) 2022-08-16 14:10:12 +05:30
Ankush Menat
81b37cb7d2
refactor: clean up code to py310 supported features (#17367)
refactor: clean up code to py39+ supported syntax

- f-strings instead of format
- latest typing support instead of pre 3.9 TitleCase
- remove UTF-8 declarations.
- many more changes

Powered by https://github.com/asottile/pyupgrade/ + manual cleanups
2022-07-01 11:51:05 +05:30
ruthra kumar
a202f1a621 feat: run tests all doctypes in module def 2022-06-08 11:54:36 +05:30
Ankush Menat
8a0a5c54da test!: dont autocommit on test object recreation 2022-04-22 19:47:54 +05:30
Ankush Menat
296a6bd02f
test: show locals on test failure (#16687)
- Show locals always in CI
- Show locals locally when running in verbose mode
2022-04-20 15:37:54 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Gavin D'souza
f8b52d8e4f Merge branch 'develop' of github.com:frappe/frappe into update-title-types 2022-02-24 11:56:00 +05:30
Gavin D'souza
0859a3060c chore: Remove comments, trailing whitespaces, etc 2022-02-24 11:35:00 +05:30
Ankush Menat
2c2d8b8e08 fix: explicitly ignore duplicates 2022-02-23 14:11:30 +05:30
barredterra
745297a49d refactor: a not in b
Search: if not ([\w\d]*?) in ([\w\d]*?)
Replace: if $1 not in $2
2022-02-21 19:54:34 +01:00
Gavin D'souza
9091b2a037 feat(minor): Case option in run-tests for specifying TestCase 2022-01-28 18:31:35 +05:30
Conor
40ba1ac9ba fix: Postgres Compatibility
* Handle inconsistencies in type handling in DatabaseQuery & Database
  APIs
* Update incompatible queries with frappe.qb notation
* Fixed use cases discovered by failing ERPNext CI tests

fix: db independent syntax for user_type

fix: handle postgres datetime values

feat: add ability to auto commit on db inserts

feat: add ability to escape underscore in postgres

fix: handle missing data in test runner bootstrapping

fix: db independent syntax for queries

fix: refactor to use qb

fix: update cache for language

fix: use pluck in email_queue

Co-authored-by: gavin <gavin18d@gmail.com>

fix: don't auto insert on tests for make_property_setter

fix: remove auto_commit in custom_field insertion

fix: remove auto_commit functionality

fix: review comments

fix: revert link validation

fix: style suggestion for readability

Co-authored-by: gavin <gavin18d@gmail.com>

fix: revert .lower() in link validation

fix: add rollback for setup_wizard

Revert "fix: add rollback for setup_wizard"

This reverts commit 83b3b0913db17718ccd5edae01858cff15603829.

Revert "feat: add ability to escape underscore in postgres"

This reverts commit 8ed9c2aa3306438e94bb813f60e65b416d0b947b.

fix: more concise representation of order fields

Co-authored-by: gavin <gavin18d@gmail.com>
2022-01-07 10:44:57 +05:30
Ankush Menat
4755f416db test: restore scheduler state after running tests 2021-10-29 15:16:29 +05:30
Ankush Menat
13a2c3403c test: enable scheduler back after running the test 2021-10-29 13:10:28 +05:30
Ankush Menat
1bf4359f9c fix: only import xmlrunner if coverage is required 2021-10-25 16:59:43 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
ChillarAnand
32759cfc90 fix: Passed failfast flag to unit test runner in all scenarios 2021-08-25 08:03:48 +05:30
leela
db09a85183 refactor: Add authentication for Redis Queue 2021-07-26 21:09:34 +05:30
Ankush Menat
a164dd0a8c
fix: test failure due to uncommited transaction
Steps to reproduce:
- Create a fresh new site with Frappe
- Add and install a new app.
- Add basic test_file.py anywhere in module.
- Run the single using test with bench command:
`bench --module module.dotted.path --test testname`

The test will not run and complain about implicit commit.

- root cause: test runner makes changes to DB but does not commit. e.g.
disabling of scheduler on L57.

Note: this is not reproducible in FF or when ERPNext is installed
because in many places of "test process" somethng else commits the
changes like `before_tests` hook, which usually isn't present in new
apps.
2021-06-11 16:27:55 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Suraj Shetty
803741466d fix: Sort dependency options for predictability 2021-05-10 18:38:36 +05:30
Suraj Shetty
76348b892f refactor: Move parallel test runner code to a separate file 2021-05-09 09:32:28 +05:30
Suraj Shetty
13be89f049 style: Fix sider issues 2021-05-08 15:45:54 +05:30
Suraj Shetty
2c54549677 feat: Make parallel test independent of test orchestrator 2021-05-07 21:58:43 +05:30
Suraj Shetty
5ccccf104d chore: Track before test time 2021-05-06 17:39:19 +05:30
Suraj Shetty
c1ea512b3a feat: Indicate slow tests 2021-05-06 14:51:27 +05:30
Suraj Shetty
c5910f91ee ci: Fix coverage file path 2021-05-05 16:17:17 +05:30
Suraj Shetty
bb833799dc fix: Click ctx error 2021-05-05 14:47:41 +05:30
Suraj Shetty
0375b9f3af chore: Enable coveralls 2021-05-05 14:05:12 +05:30
Suraj Shetty
f6fa55f76c fix: Run before test hooks 2021-05-05 13:31:02 +05:30
Suraj Shetty
e33a09f4e6 refactor: Test runner
- fix style
- Handle global dependency
2021-05-05 13:15:25 +05:30
Suraj Shetty
7ac3b53c1c feat: Add support for build combined coverage file
- from parallel tests
- Update workflow files
2021-05-02 21:01:47 +05:30
Suraj Shetty
249fa6d21b feat: Add run-parallel-tests command
- Tests will be distributed across different build machines
(dependent on test orchestrator)
- PrettyPrint for test results
2021-05-02 14:28:16 +05:30
Walstan Baptista
a15e1a7d59
test: sort folders and files before running tests for consistency (#12689)
* fix: sorted folders list befor adding tests

* fix: sort files as well

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>

* fix: remove unnecessary cstr

* fix: minor code quality change

* test: use unique `user_email` in `TestAuth`

* test: Use unique username for auth test

* test: Delete DocType Doc A completely after test is done

* test: Fix permission issue & typo in test cases

Co-authored-by: Sagar Vora <sagar@resilient.tech>
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
Co-authored-by: Suraj Shetty <surajshetty3416@gmail.com>
2021-03-26 12:33:46 +00:00
prssanna
459f65ba18 test: explicitly start transaction before each test 2021-03-15 18:05:24 +05:30
Suraj Shetty
36923b530b test: Explicitly begin transaction before test to allow rollback 2021-03-15 18:05:24 +05:30
mathieu.brunot
d38e9855be
Merge remote-tracking branch 'origin/develop' into ci/reports
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
2019-12-14 14:38:43 +01:00
Faris Ansari
488c68df96
Merge branch 'develop' into refactor-scheduler 2019-12-02 13:16:45 +05:30
mathieu.brunot
469944d273
🐛 Change runner init if XML report on
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
2019-11-26 04:00:14 +01:00
mathieu.brunot
cf50b52df7
🐛 Allow Unit Test XML to write binary
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
2019-11-26 03:21:23 +01:00
mathieu.brunot
3073515b1c
🚧 Split runner init from test run
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
2019-11-26 03:11:40 +01:00
mathieu.brunot
0054206e43
🚧 Testing without TimeLogging
Signed-off-by: mathieu.brunot <mathieu.brunot@monogramm.io>
2019-11-25 23:23:49 +01:00
Gavin D'souza
ae48dfe2b4 chore: dropped legacy selenium dependant tests
selenium TestDriver deprecated
--ui-tests flag in `bench run-tests` deprecated
2019-11-13 15:01:05 +05:30
Rushabh Mehta
7cd329fac9 reactor(scheduler): created "Scheduler Job Type" and cleaned up scheduler 2019-11-07 12:14:09 +05:30
Faris Ansari
44028ce23a fix(test_runner): Load file if exists 2019-09-29 22:41:30 +05:30
Aditya Hase
4a2881450d fix(tests): Show test duration if it exceeds SLOW_TEST_THRESHOLD (#7119) 2019-03-27 14:38:25 +05:30
Aditya Hase
e358841d3c fix(python3): super() backward compatibility fix 2019-03-14 16:52:13 +05:30
Aditya Hase
a873a19094 feat(tests): Record time required for each test 2019-03-08 12:28:41 +05:30