""" create a unique database for this particular test run """ database_url = f"psql://myapp- " return database_get_instance( database_url)Īdditionally, during a test run, the following environment variable is defined:
fixture( scope = "session", autouse = True) def create_unique_database( testrun_uid): Import pytest from posix_ipc import Semaphore, O_CREAT pytest. Wanted to create a separate database for each test run: Workers, you can use the testrun_uid fixture. If you need to globally distinguish one test run from others in your Uniquely identifying the current test run Please try not to rely on the title format or title changes inĮxternal scripts. This is intended purely as an UX enhancement, e.g. Pointer regarding the Process Explorer tool. For Windows, please follow setproctitle's , visible in standard tools like ps and top on
#USE PYTEST FOR PYTHON3 MAC UPDATE#
Update the process title (command line) on its workers to show their current If the setproctitle package is installed, pytest-xdist will use it to :param request_or_session: the `pytest` `request` or `session` object """ Identifying workers from the system environment If not distributing tests (for example passing `-n0` or not passing `-n` at all) also return 'master'. """Return the id of the current worker ('gw0', 'gw1', etc) or 'master' if running on the controller node. """Deprecated alias for is_xdist_controller.""" def get_xdist_worker_id( request_or_session) -> str: :param request_or_session: the `pytest` `request` or `session` object """ def is_xdist_master( request_or_session) -> bool: """Return `True` if this is the xdist controller, `False` otherwise Note: this method also returns `False` when distribution has not been activated at all. """Return `True` if this is an xdist worker, `False` otherwise :param request_or_session: the `pytest` `request` or `session` object """ def is_xdist_controller( request_or_session) -> bool: Def is_xdist_worker( request_or_session) -> bool: