-- -- --- --- --- --- --- --- ------- ------- ------- |
from click.testing import CliRunner
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
import wily.__main__ as main
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
def test_list_metrics(builddir):
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
"""
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
Test that list-metrics works and is ordered
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
"""
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
runner = CliRunner()
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
result = runner.invoke(main.cli, ["list-metrics"])
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
assert result.stdout.count("operator") == 4
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
assert "cyclomatic" in result.stdout
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
assert "maintainability" in result.stdout
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
assert "raw" in result.stdout
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
assert "halstead" in result.stdout
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
# Test ordering
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
i = result.stdout.index
-- -- 003 011 008 014 014 022 0083.76 0159.91 0001.91 |
assert i("cyclomatic") < i("maintainability") < i("raw") < i("halstead")
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- -- --- --- --- --- --- --- ------- ------- ------- |
-- 01 002 007 005 010 009 015 0047.55 0067.93 0001.43 |
def test_list_metrics_wrapped(builddir):
-- -- 002 007 005 010 009 015 0047.55 0067.93 0001.43 |
"""
-- -- --- --- --- --- --- --- ------- ------- ------- |
Test that list-metrics works with wrapping
-- -- --- --- --- --- --- --- ------- ------- ------- |
"""
-- -- --- --- --- --- --- --- ------- ------- ------- |
runner = CliRunner()
-- -- --- --- --- --- --- --- ------- ------- ------- |
result = runner.invoke(main.cli, ["list-metrics", "--wrap"])
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert result.stdout.count("operator") == 4
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert "cyclomatic" in result.stdout
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert "maintainability" in result.stdout
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert "raw" in result.stdout
-- -- --- --- --- --- --- --- ------- ------- ------- |
assert "halstead" in result.stdout