From bac72da029a411d3c80bff85ea03fd823d5ba8d7 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 24 Oct 2020 21:03:04 -0700 Subject: [PATCH] remove fine grained test skip logic and now depend on tool existence The test suite should now pass on developers' machines, regardless of which build configuration or subset of tools they use. Closes #1851. --- rtest/test_regression.py | 31 ++--------- rtest/test_tools.py | 110 ++------------------------------------- 2 files changed, 7 insertions(+), 134 deletions(-) diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 28b5f251c..7d1f96c36 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -1,5 +1,6 @@ import pytest import platform +import shutil import signal import subprocess import os @@ -208,12 +209,7 @@ def test_1449(): assert stderr.strip() == '', 'SVG color scheme use caused warnings' -# FIXME: Remove skip when -# https://gitlab.com/graphviz/graphviz/-/issues/1753 is fixed -@pytest.mark.skipif( - os.environ.get('build_system') == 'cmake', - reason='The Windows "CMake" installer does not install gvpr (#1753)' -) +@pytest.mark.skipif(shutil.which('gvpr') is None, reason='GVPR not available') def test_1594(): ''' GVPR should give accurate line numbers in error messages @@ -331,15 +327,7 @@ def test_1783(): assert ret != -signal.SIGSEGV, 'Graphviz segfaulted' -# FIXME: Remove skip when -# https://gitlab.com/graphviz/graphviz/-/issues/1857 and -# https://gitlab.com/graphviz/graphviz/-/issues/1816 is fixed -@pytest.mark.skipif( - os.environ.get('build_system') == 'cmake' or - platform.system() == 'Darwin' or - platform.system() == 'Windows', - reason='gvedit is not built for macOS or Windows or using CMake (#1816 & #1857)' -) +@pytest.mark.skipif(shutil.which('gvedit') is None, reason='Gvedit not available') def test_1813(): ''' gvedit -? should show usage @@ -354,18 +342,7 @@ def test_1813(): assert 'Usage' in output, 'gvedit -? did not show usage' -# FIXME: Remove skip when -# https://gitlab.com/graphviz/graphviz/-/issues/1753 is fixed -@pytest.mark.skipif( - os.environ.get('build_system') == 'cmake', - reason='The Windows "CMake" installer does not install lefty (#1753)' -) -# FIXME: Remove skip when -# https://gitlab.com/graphviz/graphviz/-/issues/1858 is fixed -@pytest.mark.skipif( - platform.system() == 'Darwin', - reason='lefty is not built on macOS (#1858)' -) +@pytest.mark.skipif(shutil.which('lefty') is None, reason='Lefty not available') def test_1818(): ''' lefty -? should show usage diff --git a/rtest/test_tools.py b/rtest/test_tools.py index ba6d931aa..428ac75be 100644 --- a/rtest/test_tools.py +++ b/rtest/test_tools.py @@ -2,6 +2,7 @@ import os import platform import pytest import re +import shutil import subprocess import shutil @@ -52,111 +53,14 @@ import shutil ]) def test_tools(tool): - tools_not_built_with_cmake = [ - 'circo', - 'cluster', - 'diffimg', - 'dot2gxl', - 'dot_builtins', - 'dotty', - 'edgepaint', - 'fdp', - 'gv2gml', - 'gv2gxl', - 'gvedit', - 'gvmap', - 'gvmap.sh', - 'gvpr', - 'gxl2dot', - 'lefty', - 'lneato', - 'mingle', - 'neato', - 'osage', - 'patchwork', - 'prune', - 'sfdp', - 'smyrna', - 'twopi', - 'vimdot', - ] - - tools_not_built_with_msbuild = [ - 'circo', - 'cluster', - 'dot2gxl', - 'dot_builtins', - 'fdp', - 'gv2gxl', - 'gvedit', - 'gvmap.sh', - 'gxl2dot', - 'neato', - 'osage', - 'patchwork', - 'sfdp', - 'twopi', - 'vimdot', - ] - - tools_not_built_with_autotools_on_macos = [ - 'dotty', - 'gvedit', - 'lefty', - 'lneato', - 'mingle', - 'smyrna', - 'vimdot', - ] - - os_id = os.getenv('OS_ID') + if shutil.which(tool) is None: + pytest.skip('{} not available'.format(tool)) # FIXME: Remove skip when # https://gitlab.com/graphviz/graphviz/-/issues/1829 is fixed if tool == 'smyrna' and os.getenv('build_system') == 'msbuild': pytest.skip('smyrna fails to start because of missing DLLs in Windows MSBuild builds (#1829)') - # FIXME: Remove skip when - # https://gitlab.com/graphviz/graphviz/-/issues/1834 is fixed - if tool == 'smyrna' and os_id == 'centos': - check_that_tool_does_not_exist(tool, os_id) - pytest.skip('smyrna is not built for Centos (#1834)') - - # FIXME: Remove skip when - # https://gitlab.com/graphviz/graphviz/-/issues/1835 is fixed - if tool == 'mingle' and os_id in ['ubuntu', 'centos']: - check_that_tool_does_not_exist(tool, os_id) - pytest.skip('mingle is not built for ' + os_id + ' (#1835)') - - # FIXME: Remove skip when - # https://gitlab.com/graphviz/graphviz/-/issues/1839 is fixed - if tool == 'dot_builtins' and os_id in ['centos', 'fedora']: - check_that_tool_does_not_exist(tool, os_id) - pytest.skip('dot_builtins is not installed for ' + os_id + ' (#1839)') - - # FIXME: Remove skip when - # https://gitlab.com/graphviz/graphviz/-/issues/1753 and - # https://gitlab.com/graphviz/graphviz/-/issues/1836 is fixed - if os.getenv('build_system') == 'cmake': - if tool in tools_not_built_with_cmake: - check_that_tool_does_not_exist(tool, os_id) - pytest.skip(tool + ' is not built with CMake (#1753 & #1836)') - - # FIXME: Remove skip when - # https://gitlab.com/graphviz/graphviz/-/issues/1837 is fixed - if os.getenv('build_system') == 'msbuild': - if tool in tools_not_built_with_msbuild: - check_that_tool_does_not_exist(tool, os_id) - pytest.skip(tool + ' is not built with MSBuild (#1837)') - - # FIXME: Remove skip when - # https://gitlab.com/graphviz/graphviz/-/issues/1854 is fixed - if os.getenv('build_system') == 'autotools': - if platform.system() == 'Darwin': - if tool in tools_not_built_with_autotools_on_macos: - check_that_tool_does_not_exist(tool, os_id) - pytest.skip(tool + ' is not built with autotools on macOS (#1854)') - # FIXME: Remove skip when # https://gitlab.com/graphviz/graphviz/-/issues/1838 is fixed if tool == 'gvpack' and platform.system() != 'Windows': @@ -186,11 +90,3 @@ def test_tools(tool): ) assert returncode != 0, tool + ' accepted unsupported option -$' - -def check_that_tool_does_not_exist(tool, os_id): - assert shutil.which(tool) is None, '{} has been resurrected in the {} ' \ - 'build on {}. Please remove skip.'.format( - tool, - os.getenv('build_system'), - os_id - ) -- 2.40.0