Skip to content

Commit

Permalink
unittests: Assert that we have pkg-config on all CI
Browse files Browse the repository at this point in the history
Our appveyor configuration provides pkg-config when building for
mingw, cygwin, msvc, etc.

Of course, people manually running the tests won't require pkg-config.
  • Loading branch information
nirbheek committed Jun 18, 2018
1 parent 96b7fdb commit d2d1a7c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions run_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,22 @@ def get_soname(fname):
def get_rpath(fname):
return get_dynamic_section_entry(fname, r'(?:rpath|runpath)')

def is_ci():
if 'TRAVIS' in os.environ or 'APPVEYOR' in os.environ:
return True
return False

def skipIfNoPkgconfig(f):
'''
Skip this test if no pkg-config is found, unless we're on Travis CI
This allows users to run our test suite without having pkg-config installed
on, f.ex., macOS, while ensuring that our Travis CI does not silently skip
the test because of misconfiguration.
Skip this test if no pkg-config is found, unless we're on Travis or
Appveyor CI. This allows users to run our test suite without having
pkg-config installed on, f.ex., macOS, while ensuring that our CI does not
silently skip the test because of misconfiguration.
Note: Yes, we provide pkg-config even while running Windows CI
'''
def wrapped(*args, **kwargs):
if 'TRAVIS' not in os.environ and shutil.which('pkg-config') is None:
if is_ci() and shutil.which('pkg-config') is None:
raise unittest.SkipTest('pkg-config not found')
return f(*args, **kwargs)
return wrapped
Expand Down

0 comments on commit d2d1a7c

Please sign in to comment.