Fixtures Provided by Test Package#
Pytest package uses fixtures for initializing and customization of tests. You can learn more about fixtures on official pytest documentation as well as see the list of fixtures provided by pytest package itself.
onetick-py provides separated package for query testing called onetick-py-test, this package is a dependency of onetick-py package, so if the one install onetick-py package they will have access to testing package as will. onetick-py-test package provides several fixtures for simplifying test creating.
Session fixtures#
Name |
Description |
---|---|
|
Session with function scope. Previous session will be closed as function will start. Session exists only while function (only one test) is running. |
|
Session with class scope. |
|
Session with module (test file) scope. |
|
Session with package scope. |
|
Session with pytest session scope. The will be only one Onetick session for all tests. |
Folder fixtures#
Name |
Description |
---|---|
|
Returns absolute path to the folder with the test. |
|
Returns absolute path to the parent folder of the test. |
|
Returns absolute path to the nearest product parent directory. The search is starting from the path directory and moving to a parent folders. If a parent folder contains necessary files and subdirectories, then the function returns absolute path to that directory; if it reaches the root ‘/’, then the error will be raised. |
|
Returns absolute path to the nearest product parent directory. The search is starting from the path directory and moving to a parent folders. If a parent folder contains necessary files and subdirectories, then the function returns absolute path to that directory; if it reaches the root ‘/’, then the function returns “None”. |
|
Returns absolute path to the nearest client_data parent directory. The search is starting from the path directory and moving to a parent folders. If a parent folder contains necessary files and subdirectories, then the function returns absolute path to that directory; if it reaches the root ‘/’, then the error will be raised. |
|
Returns absolute path to the nearest client_data parent directory. The search is starting from the path directory and moving to a parent folders. If a parent folder contains necessary files and subdirectories, then the function returns absolute path to that directory; if it reaches the root ‘/’, then the function returns “None”. |
|
Returns absolute path to the folder were test will be saved if keep-generated flag was specified. |