Skip to content

Commit cef406b

Browse files
committed
run_unittests: delete test for external syntax highlighting
It's a bit odd we have a test for an external project that's not even in the meson organization. Regardless, the json file was recently replaced by a cson file. There is an coffee-script-notation parser in pypi, but I couldn't get it to work. Just delete the test
1 parent 9133748 commit cef406b

1 file changed

Lines changed: 0 additions & 46 deletions

File tree

run_unittests.py

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,6 @@ def is_ci():
125125
return True
126126
return False
127127

128-
def is_pull():
129-
# Travis
130-
if os.environ.get('TRAVIS_PULL_REQUEST', 'false') != 'false':
131-
return True
132-
# Azure
133-
if 'SYSTEM_PULLREQUEST_ISFORK' in os.environ:
134-
return True
135-
return False
136-
137128
def _git_init(project_dir):
138129
subprocess.check_call(['git', 'init'], cwd=project_dir, stdout=subprocess.DEVNULL)
139130
subprocess.check_call(['git', 'config',
@@ -1449,43 +1440,6 @@ def test_vim_syntax_highlighting(self):
14491440
res = re.search(r'syn keyword mesonBuiltin(\s+\\\s\w+)+', f.read(), re.MULTILINE)
14501441
defined = set([a.strip() for a in res.group().split('\\')][1:])
14511442
self.assertEqual(defined, set(chain(interp.funcs.keys(), interp.builtin.keys())))
1452-
1453-
@unittest.skipIf(is_pull(), 'Skipping because this is a pull request')
1454-
def test_json_grammar_syntax_highlighting(self):
1455-
'''
1456-
Ensure that syntax highlighting JSON grammar written by TingPing was
1457-
updated for new functions in the global namespace in build files.
1458-
https://github.com/TingPing/language-meson/
1459-
'''
1460-
env = get_fake_env()
1461-
interp = Interpreter(FakeBuild(env), mock=True)
1462-
url = 'https://raw.githubusercontent.com/TingPing/language-meson/master/grammars/meson.json'
1463-
try:
1464-
# Use a timeout to avoid blocking forever in case the network is
1465-
# slow or unavailable in a weird way
1466-
r = urllib.request.urlopen(url, timeout=URLOPEN_TIMEOUT)
1467-
except urllib.error.URLError as e:
1468-
# Skip test when network is not available, such as during packaging
1469-
# by a distro or Flatpak
1470-
if not isinstance(e, urllib.error.HTTPError):
1471-
raise unittest.SkipTest('Network unavailable')
1472-
# Don't fail the test if github is down, but do fail if 4xx
1473-
if e.code >= 500:
1474-
raise unittest.SkipTest('Server error ' + str(e.code))
1475-
raise e
1476-
# On Python 3.5, we must decode bytes to string. Newer versions don't require that.
1477-
grammar = json.loads(r.read().decode('utf-8', 'surrogatepass'))
1478-
for each in grammar['patterns']:
1479-
if 'name' in each and each['name'] == 'support.function.builtin.meson':
1480-
# The string is of the form: (?x)\\b(func1|func2|...\n)\\b\\s*(?=\\() and
1481-
# we convert that to [func1, func2, ...] without using regex to parse regex
1482-
funcs = set(each['match'].split('\\b(')[1].split('\n')[0].split('|'))
1483-
if 'name' in each and each['name'] == 'support.variable.meson':
1484-
# \\b(builtin1|builtin2...)\\b
1485-
builtin = set(each['match'].split('\\b(')[1].split(')\\b')[0].split('|'))
1486-
self.assertEqual(builtin, set(interp.builtin.keys()))
1487-
self.assertEqual(funcs, set(interp.funcs.keys()))
1488-
14891443
def test_all_functions_defined_in_ast_interpreter(self):
14901444
'''
14911445
Ensure that the all functions defined in the Interpreter are also defined

0 commit comments

Comments
 (0)