Exemple #1
0
def test_result_log_warning_capture_with_stack_level(testdir, monkeypatch):
    config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")

    def mock__issue_warning_captured(warning, hook, stacklevel=0):
        assert 2 == stacklevel

    monkeypatch.setattr(
        _pytest.warnings, "_issue_warning_captured", mock__issue_warning_captured
    )

    pytest_configure(config)
def test_no_resultlog_on_slaves(testdir):
    config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")

    assert not hasattr(config, "_resultlog")
    pytest_configure(config)
    assert hasattr(config, "_resultlog")
    pytest_unconfigure(config)
    assert not hasattr(config, "_resultlog")

    config.slaveinput = {}
    pytest_configure(config)
    assert not hasattr(config, "_resultlog")
    pytest_unconfigure(config)
    assert not hasattr(config, "_resultlog")
def test_no_resultlog_on_slaves(testdir):
    config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")

    assert not hasattr(config, '_resultlog')
    pytest_configure(config)
    assert hasattr(config, '_resultlog')
    pytest_unconfigure(config)
    assert not hasattr(config, '_resultlog')

    config.slaveinput = {}
    pytest_configure(config)
    assert not hasattr(config, '_resultlog')
    pytest_unconfigure(config)
    assert not hasattr(config, '_resultlog')
Exemple #4
0
def test_no_resultlog_on_slaves(testdir):
    config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")

    assert resultlog_key not in config._store
    pytest_configure(config)
    assert resultlog_key in config._store
    pytest_unconfigure(config)
    assert resultlog_key not in config._store

    config.slaveinput = {}
    pytest_configure(config)
    assert resultlog_key not in config._store
    pytest_unconfigure(config)
    assert resultlog_key not in config._store
Exemple #5
0
def test_no_resultlog_on_workers(testdir: Testdir) -> None:
    config = testdir.parseconfig("-p", "resultlog", "--resultlog=resultlog")

    assert resultlog_key not in config._store
    pytest_configure(config)
    assert resultlog_key in config._store
    pytest_unconfigure(config)
    assert resultlog_key not in config._store

    config.workerinput = {}  # type: ignore[attr-defined]
    pytest_configure(config)
    assert resultlog_key not in config._store
    pytest_unconfigure(config)
    assert resultlog_key not in config._store