Package schrodinger :: Package test :: Module pytest_customizations
[hide private]
[frames] | no frames]

Module pytest_customizations

Local Schrodinger py.test customizations.

todo: It would be nice to have a SCHRODINGER traceback printer that removed $SCHRODINGER from each path.

Classes [hide private]
  ExecutableFile
A compiled executable file that should be executed as a test.
  ProcessDied
  KilledProcess
  BoostTestFailure
  ExecutableTest
Use $SCHRODINGER/run to execute a file with no arguments.
  Makefile
  MakefileTest
Run the `make test` target in a directory.
Functions [hide private]
 
pytest_runtest_setup(item)
Execute each test in the directory where the test file lives.
 
format_captured_exceptions(exceptions)
Formats exceptions given as (type, value, traceback) into a string suitable to display as a test failure.
 
pytest_runtest_teardown(item, nextitem)
 
pytest_addoption(parser)
Add Schrodinger options to run the post tests, or just the fastest tests.
 
extend_pythonpath(additional_paths)
Add "additional_paths" to the PYTHONPATH.
 
schrodinger_pytest_load_initial_conftests(early_config, parser, args)
 
pytest_cmdline_main(config)
 
pytest_configure(config)
Post-Process the pytest configuration.
 
pytest_report_teststatus(report)
Put Killed tests into a separate group from other failures.
 
pytest_terminal_summary(terminalreporter)
Print Killed tests.
 
pytest_sessionfinish(session, exitstatus)
If there is uncollectable garbage, report about it and exit non-zero.
 
pytest_unconfigure(config)
At the end of the py.test process, report: * memory use * all processes belonging to current user (for user buildbot)
 
pytest_collect_file(parent, path)
Pytest function: Should "path" be collected as a test?
 
pytest_itemcollected(item)
Don't run python tests under memtest.
 
pytest_collection_modifyitems(items)
 
_kill_process_and_children(pid, timeout=5)
Terminate and ultimately kill a process and all of its children after a waiting (at most) timeout seconds.
 
start_qapp()
Start a qapp in this process if a display is present.
Variables [hide private]
  SCHRODINGER_RUN = '/scr/buildbot/savedbuilds/NB/2016-4/build-1...
  MEMTEST = ('valgrind', '--tool=memcheck', '--time-stamp=yes', ...
  _QAPP = None
hash(x)
  __package__ = 'schrodinger.test'
Function Details [hide private]

pytest_runtest_setup(item)

 

Execute each test in the directory where the test file lives.

Capture exceptions that occur outside of the main thread (for instance in event loops).

pytest_addoption(parser)

 

Add Schrodinger options to run the post tests, or just the fastest tests.

This is a pytest hook.

extend_pythonpath(additional_paths)

 

Add "additional_paths" to the PYTHONPATH. Also adds schrodinger.test and the test_modules directory.

pytest_configure(config)

 

Post-Process the pytest configuration. Basically to overload the -m argument and play well with --pypath.

Decorators:
  • @pytest.mark.tryfirst

pytest_terminal_summary(terminalreporter)

 

Print Killed tests. Change reporting for failed tests.

pytest_unconfigure(config)

 

At the end of the py.test process, report: * memory use * all processes belonging to current user (for user buildbot)

This is done as late as possible so that parallel py.tests from pytest-xdist won't interfere.

pytest_collect_file(parent, path)

 

Pytest function: Should "path" be collected as a test?

Adds compiled tests.

_kill_process_and_children(pid, timeout=5)

 

Terminate and ultimately kill a process and all of its children after a waiting (at most) timeout seconds.

This is required when we kill a process on Windows because we need to wait for the process to complete before cleaning up its files.

start_qapp()

 

Start a qapp in this process if a display is present.

Decorators:
  • @pytest.fixture(scope= "session", autouse= True)

Variables Details [hide private]

SCHRODINGER_RUN

Value:
'/scr/buildbot/savedbuilds/NB/2016-4/build-126/run'

MEMTEST

Value:
('valgrind',
 '--tool=memcheck',
 '--time-stamp=yes',
 '--num-callers=20',
 '--gen-suppressions=all',
 '--leak-check=yes',
 '--error-exitcode=29',
 '--log-file={}_valgrind.log')