You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
only("hello.py") # only hello.py will be presentinclude("*.csv") # also include all csv filesexclude("foo.csv", "bar.csv") # don't include foo.csv and bar.csvrequire("qux.zip") # make sure qux.zip exists and then include qux.zip
Calling any of these functions will create a sandbox (a temporary directory) and copy all included files over. Each subsequent call will not create another sandbox, but will move any newly included or excluded files from or to the sandbox.
The api functions can be called in the test module and inside each test. A call in the module will create one sandbox for all tests to use. Useful for any compiling or pipeline-ish operation. For example:
fromcheckpyimport*importosonly("foo.py")
@test()deftestFoo1():
"""Foo 1"""withopen('pretend_result_of_foo.csv", "w") asf:
pass@passed(testFoo, hide=False) # @passed is not necessary, but probably the right thing to do heredeftestFoo2():
"""Foo 2"""assert"pretend_result_of_foo.csv"inos.listdir()
Calling an api function inside a test will create a new sandbox for the test alone. It can only copy files from the module level sandbox if that also exists. test-level calls are useful for ensuring a clean slate for each test and for controlling files per test. For example:
fromcheckpyimport*importosonly("foo.py", "bar.py")
@test()deftestFoo():
"""Foo works"""only("foo.py") # cannot include "qux.py" here because of module level sandboxassertos.listdir() == ["foo.py"]
The text was updated successfully, but these errors were encountered:
With the following api:
Calling any of these functions will create a sandbox (a temporary directory) and copy all included files over. Each subsequent call will not create another sandbox, but will move any newly included or excluded files from or to the sandbox.
The api functions can be called in the test module and inside each test. A call in the module will create one sandbox for all tests to use. Useful for any compiling or pipeline-ish operation. For example:
Calling an api function inside a test will create a new sandbox for the test alone. It can only copy files from the module level sandbox if that also exists. test-level calls are useful for ensuring a clean slate for each test and for controlling files per test. For example:
The text was updated successfully, but these errors were encountered: