-- -- --- --- --- --- --- --- ------- ------- ------- |
from click.testing import CliRunner
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
import wily.__main__ as main
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
def test_index_no_cache(tmpdir, cache_path):
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
"""
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
Test that wily index fails in a directory that has no cache
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
"""
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
runner = CliRunner()
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
result = runner.invoke(main.cli, ["--path", tmpdir, "--cache", cache_path, "index"])
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
assert "An author" not in result.stdout
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
assert result.exit_code == 1, result.stdout
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
def test_index(builddir):
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
"""
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
Test that index works with a build
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
"""
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
runner = CliRunner()
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
result = runner.invoke(main.cli, ["--path", builddir, "index"])
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
assert result.stdout.count("An author") >= 3
-- -- 002 004 002 004 006 006 0015.51 0015.51 0001.00 |
assert result.exit_code == 0, result.stdout
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
def test_index_with_messages(builddir):
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
"""
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
Test that index works with a build with git commit messages
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
"""
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
runner = CliRunner()
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
result = runner.invoke(main.cli, ["--path", builddir, "index", "--message"])
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
assert result.stdout.count("An author") == 3
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
assert "basic test" in result.stdout
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
assert "add line" in result.stdout
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
assert "remove line" in result.stdout
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
assert result.exit_code == 0, result.stdout
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
def test_index_with_messages_wrapped(builddir):
-- -- 002 008 005 010 010 015 0049.83 0062.29 0001.25 |
"""
-- -- --- --- --- --- --- --- ------- ------- ------- |
Test that index works with a build with git commit messages and wrapping
-- -- --- --- --- --- --- --- ------- ------- ------- |
"""
-- -- --- --- --- --- --- --- ------- ------- ------- |
runner = CliRunner()
-- -- --- --- --- --- --- --- ------- ------- ------- |
result = runner.invoke(
-- -- --- --- --- --- --- --- ------- ------- ------- |
main.cli, ["--path", builddir, "index", "--message", "--wrap"]
-- -- --- --- --- --- --- --- ------- ------- ------- |
)
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert result.stdout.count("An author") == 3
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert "basic test" in result.stdout
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert "add line" in result.stdout
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert "remove line" in result.stdout
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert result.exit_code == 0, result.stdout