예제 #1
0
def test_find_version_from_file_double_quotes(ctx: Context) -> None:
    (ctx.root / "file.py").write_text('version = "0.0.7"')
    assert "0.0.7" == find_version(ctx, "file.py", "")
예제 #2
0
def test_find_version_not_found(ctx: Context) -> None:
    (ctx.root / "file.py").write_text("not_a_version = '0.0.7'")
    with pytest.raises(ValueError, match="Unable to determine version"):
        find_version(ctx, "file.py", "")
예제 #3
0
def test_find___version___no_spaces(ctx: Context) -> None:
    (ctx.root / "file.py").write_text("__version__='0.0.7'")
    assert "0.0.7" == find_version(ctx, "file.py", "")
예제 #4
0
def test_find_version_from_file_single_quotes(ctx: Context) -> None:
    (ctx.root / "file.py").write_text("version = '0.0.7'")
    assert "0.0.7" == find_version(ctx, "file.py", "")
예제 #5
0
def test_find_version_file_mismatch_with_autodetected(ctx: Context) -> None:
    with pytest.raises(ValueError, match="mismatches with autodetected "):
        (ctx.root / "file.py").write_text("__version__='1.2.3'")
        find_version(ctx, "file.py", "")
예제 #6
0
def test_find_version_explicit(ctx: Context) -> None:
    assert "0.0.7" == find_version(ctx, "", "0.0.7")
예제 #7
0
def test_find_version_mismatch_with_autodetected(ctx: Context) -> None:
    with pytest.raises(ValueError, match="mismatches with autodetected "):
        find_version(ctx, "", "1.2.3")
예제 #8
0
def test_find_version_ambigous(ctx: Context) -> None:
    with pytest.raises(ValueError, match="ambiguous"):
        (ctx.root / "file.py").write_text("__version__='1.2.3'")
        find_version(ctx, "file.py", "3.4.5")
예제 #9
0
def test_find_version_autodetected(ctx: Context) -> None:
    assert "0.0.7" == find_version(ctx, "", "")