test¶
Runs pytest with boa context.
usage: mox test [-h] [-d] [-q] [--fork [FORK]] [--network NETWORK |
--url URL | --prompt-live [PROMPT_LIVE]] [--db-path DB_PATH]
[--save-to-db [SAVE_TO_DB]] [--account ACCOUNT |
--private-key PRIVATE_KEY] [--password PASSWORD |
--password-file-path PASSWORD_FILE_PATH] [--gas-profile]
[-k [K]] [-m [M]] [-x] [-s] [--capture [CAPTURE ]] [--lf]
[--cache-clear] [--disable-warnings] [--full-trace] [--pdb]
[--coverage] [--cov COV] [--cov-report [COV_REPORT ...]]
[--cov-config COV_CONFIG] [--no-cov-on-fail] [--no-cov]
[--cov-reset] [--cov-fail-under COV_FAIL_UNDER] [--cov-append]
[--cov-branch] [--cov-context COV_CONTEXT]
[--tb {auto,long,short,no,line,native}] [-v]
[--hypothesis-seed HYPOTHESIS_SEED] [-n NUMPROCESSES]
[--dist {load,loadscope,loadfile,loadgroup,no,worksteal}]
[file_or_dir]
Positional Arguments¶
- file_or_dir
Name of the test or folder to run tests on, or the path to your script.
Named Arguments¶
- -d, --debug
Run in debug mode
Default:
False
- -q, --quiet
Suppress all output except errors
Default:
False
- --fork
- --network
Alias of the network (from the moccasin.toml).
- --url, --rpc
RPC URL to run the script on.
- --prompt-live
Prompt the user to make sure they want to run this script.
- --db-path
The location of your database, defaults to your working project’s database in your {CONFIG_NAME}.
- --save-to-db
Save the deployment to the database.
- --account
Keystore account you want to use.
- --private-key
Private key you want to use to get an unlocked account.
- --password
Password for the keystore account.
- --password-file-path
Path to the file containing the password for the keystore account.
- --gas-profile
Get an output on gas use for test functions.
Default:
False
- -k
- Only run tests which match the given substring expression. An expression is a Python evaluable expression where all names are
substring-matched against test names and their parent classes. Example: -k ‘test_method or test_other’ matches all test functions and classes whose name contains ‘test_method’ or ‘test_other’, while -k ‘not test_method’ matches those that don’t contain ‘test_method’ in their names. -k ‘not test_method and not test_other’ will eliminate the matches. Additionally keywords are matched to classes and functions containing extra names in their ‘extra_keyword_matches’ set, as well as functions which have names assigned directly to them. The matching is case-insensitive.
- -m
Only run tests matching given mark expression. For example: -m ‘mark1 and not mark2’.
- -x, --exitfirst
Exit instantly on first error or failed test.
Default:
False
- -s
A way to show print lines from tests. Shortcut for –capture=no
Default:
False
- --capture
Per-test capturing method: one of fd|sys|no|tee-sys
- --lf, --last-failed
Rerun only the tests that failed at the last run (or all if none failed).
Default:
False
- --cache-clear
Remove all cache contents at start of test run.
Default:
False
- --disable-warnings, --disable-pytest-warnings
Disable warnings summary.
Default:
False
- --full-trace
Don’t cut any tracebacks (default is to cut)
Default:
False
- --pdb
Start the debugger for each test that fails.
Default:
False
- --coverage
Shorthand for adding –cov=. –cov-branch.
Default:
False
- --cov
Coverage target directory.
- --cov-report
Type of report to generate: term, term-missing, annotate, html, xml, json, lcov (multi-allowed). term, term- missing may be followed by “:skip-covered”. annotate, html, xml, json and lcov may be followed by “:DEST” where DEST specifies the output location. Use –cov-report= to not generate any output..
- --cov-config
Coverage config file, defaults to a moccasin internal config file loading the boa plugin.
- --no-cov-on-fail
Do not report coverage if test run fails.
Default:
False
- --no-cov
Disable coverage report.
Default:
False
- --cov-reset
Reset cov sources accumulated in options so far. Mostly useful for scripts and configuration files.
Default:
False
- --cov-fail-under
Fail if the total coverage is less than this value.
- --cov-append
Do not delete coverage but append to current. Default: False.
Default:
False
- --cov-branch
Enable branch coverage.
Default:
False
- --cov-context
Coverage context to add to the coverage data.
- --tb
Possible choices: auto, long, short, no, line, native
Traceback print mode
- -v, --verbose
Verbosity level
- --hypothesis-seed
Random seed to get the same run as a prior run.
- -n, --numprocesses
Number of processes to use (auto/NUM)
- --dist
Possible choices: load, loadscope, loadfile, loadgroup, no, worksteal
Load distribution mode