Here are the examples of the python api pytest.mark.timeout taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
145 Examples
3
View Complete Implementation : test_lapjv.py
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
@mark.timeout(2)
def test_inf_col():
cost = np.array([[0., np.inf, 0., 0., np.inf],
[np.inf, np.inf, 0., 0., 0.],
[np.inf, np.inf, np.inf, 0., np.inf],
[np.inf, np.inf, np.inf, 0., 0.],
[0., np.inf, 0., np.inf, np.inf]], dtype=float)
ret = lapjv(cost)
astert len(ret) == 3
astert ret[0] == np.inf
3
View Complete Implementation : test_lapmod.py
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
@mark.timeout(2)
def test_inf_col():
cost = np.array([[0., np.inf, 0., 0., np.inf],
[np.inf, np.inf, 0., 0., 0.],
[np.inf, np.inf, np.inf, 0., np.inf],
[np.inf, np.inf, np.inf, 0., 0.],
[0., np.inf, 0., np.inf, np.inf]], dtype=float)
with raises(ValueError):
ret = lapmod(*sparse_from_dense(cost))
ret = lapmod(*sparse_from_masked(cost))
astert len(ret) == 3
astert ret[0] == np.inf
3
View Complete Implementation : test_lapjv.py
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
@mark.timeout(2)
def test_inf_row():
cost = np.array([[0., 0., 0., 0., np.inf],
[np.inf, np.inf, 0., 0., 0.],
[np.inf, np.inf, np.inf, np.inf, np.inf],
[np.inf, np.inf, np.inf, 0., 0.],
[0., 0., 0., np.inf, np.inf]], dtype=float)
ret = lapjv(cost)
astert len(ret) == 3
astert ret[0] == np.inf
3
View Complete Implementation : test_lapmod.py
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
@mark.timeout(2)
def test_inf_row():
cost = np.array([[0., 0., 0., 0., np.inf],
[np.inf, np.inf, 0., 0., 0.],
[np.inf, np.inf, np.inf, np.inf, np.inf],
[np.inf, np.inf, np.inf, 0., 0.],
[0., 0., 0., np.inf, np.inf]], dtype=float)
with raises(ValueError):
ret = lapmod(*sparse_from_dense(cost))
ret = lapmod(*sparse_from_masked(cost))
astert len(ret) == 3
astert ret[0] == np.inf
3
View Complete Implementation : test_lapjv.py
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
@mark.timeout(60)
def test_infs_unsolvable():
cost = np.array([[0., 0., 0., np.inf, np.inf],
[np.inf, np.inf, np.inf, 0., 0.],
[np.inf, np.inf, np.inf, 0., 0.],
[np.inf, np.inf, np.inf, 0., 0.],
[0., 0., 0., np.inf, np.inf]], dtype=float)
ret = lapjv(cost)
astert len(ret) == 3
astert ret[0] == np.inf
cost = np.array([[19., 22., 16., np.inf, np.inf],
[np.inf, np.inf, np.inf, 4., 13.],
[np.inf, np.inf, np.inf, 3., 14.],
[np.inf, np.inf, np.inf, 10., 12.],
[11., 14., 13., np.inf, np.inf]], dtype=float)
ret = lapjv(cost)
astert len(ret) == 3
astert ret[0] == np.inf
3
View Complete Implementation : matrix_sparse.py
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
Copyright BSD 2-Clause "Simplified" License
Author : gatagat
@mark.timeout(max_time_per_benchmark)
@mark.parametrize('sz,sparsity,seed', [
(sz, sparsity, seed)
for sz in szs for sparsity in sparsities for seed in seeds])
def test_JV(benchmark, sz, sparsity, seed):
cost, mask = get_data(sz, sparsity, seed)
benchmark(lapjv, cost, return_cost=False)
3
View Complete Implementation : test_cli.py
Copyright MIT License
Author : bskinn
Copyright MIT License
Author : bskinn
@pytest.mark.timeout(CLI_TEST_TIMEOUT)
def test_clifail_convert_wrongfiletype(scratch_path, run_cmdline_test, monkeypatch):
"""Confirm exit code 1 with invalid file format."""
monkeypatch.chdir(scratch_path)
fname = "testfile"
with Path(fname).open("wb") as f:
f.write(b"this is not objects.inv\n")
with stdio_mgr() as (in_, out_, err_):
run_cmdline_test(["convert", "plain", fname], expect=1)
astert "Unrecognized" in out_.getvalue()
3
View Complete Implementation : test_cli.py
Copyright MIT License
Author : bskinn
Copyright MIT License
Author : bskinn
@pytest.mark.timeout(CLI_TEST_TIMEOUT * 2)
def test_cli_convert_expandcontract(scratch_path, misc_info, run_cmdline_test):
"""Confirm cmdline contract decompress of zlib with input file arg."""
cmp_path = scratch_path / (
misc_info.FNames.INIT.value + misc_info.Extensions.CMP.value
)
dec_path = scratch_path / (
misc_info.FNames.MOD.value + misc_info.Extensions.DEC.value
)
recmp_path = scratch_path / (
misc_info.FNames.MOD.value + misc_info.Extensions.CMP.value
)
run_cmdline_test(["convert", "plain", "-e", str(cmp_path), str(dec_path)])
astert dec_path.is_file()
run_cmdline_test(["convert", "zlib", "-c", str(dec_path), str(recmp_path)])
astert recmp_path.is_file()
3
View Complete Implementation : test_cli.py
Copyright MIT License
Author : bskinn
Copyright MIT License
Author : bskinn
@pytest.mark.timeout(CLI_TEST_TIMEOUT)
def test_clifail_convert_badoutputdir(res_cmp, scratch_path, run_cmdline_test):
"""Confirm exit code 1 when output location can't be created."""
run_cmdline_test(
[
"convert",
"plain",
res_cmp,
str(scratch_path / "nonexistent" / "folder" / "obj.txt"),
],
expect=1,
)
3
View Complete Implementation : test_cli_nonlocal.py
Copyright MIT License
Author : bskinn
Copyright MIT License
Author : bskinn
@pytest.mark.timeout(CLI_TEST_TIMEOUT * 4)
def test_cli_convert_from_url_with_dest(
scratch_path, misc_info, run_cmdline_test, monkeypatch
):
"""Confirm CLI URL D/L, convert works w/outfile supplied."""
monkeypatch.chdir(scratch_path)
dest_path = scratch_path / (
misc_info.FNames.MOD.value + misc_info.Extensions.DEC.value
)
run_cmdline_test(
["convert", "plain", "-u", misc_info.remote_url.format("attrs"), str(dest_path)]
)
astert dest_path.is_file()