pytest-boxed / testing / test_boxed.py

import py

@py.test.mark.skipif("not hasattr(os, 'fork')")
def test_functional_boxed(testdir):
    p1 = testdir.makepyfile("""
        import os
        def test_function():
            os.kill(os.getpid(), 15)
    """)
    result = testdir.runpytest(p1, "--boxed")
    result.stdout.fnmatch_lines([
        "*CRASHED*",
        "*1 failed*"
    ])

class TestOptionEffects:
    def test_boxed_option_default(self, testdir):
        tmpdir = testdir.tmpdir.ensure("subdir", dir=1)
        config = testdir.parseconfig()
        assert not config.option.boxed
        py.test.importorskip("execnet")
        config = testdir.parseconfig('-d', tmpdir)
        assert not config.option.boxed

    def test_is_not_boxed_by_default(self, testdir):
        config = testdir.parseconfig(testdir.tmpdir)
        assert not config.option.boxed
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.