return code 0 to gracefully exit if python bindings are not available

This commit is contained in:
Dane Springmeyer 2014-07-24 18:58:03 -07:00
parent 7957c05df0
commit 540f70a1f4
3 changed files with 16 additions and 10 deletions

View file

@ -985,13 +985,6 @@ struct is_null : public boost::static_visitor<bool>
boost::ignore_unused_variable_warning(val); boost::ignore_unused_variable_warning(val);
return false; return false;
} }
template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
bool operator() (boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const& val)
const
{
return boost::apply_visitor(*this, val);
}
}; };
} // namespace impl } // namespace impl

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys import sys
@ -7,6 +8,12 @@ try:
except ImportError, e: except ImportError, e:
sys.stderr.write("Unable to run python tests: the third party 'nose' module is required\nTo install 'nose' do:\n\tsudo pip install nose (or on debian systems: apt-get install python-nose): %s\n" % e) sys.stderr.write("Unable to run python tests: the third party 'nose' module is required\nTo install 'nose' do:\n\tsudo pip install nose (or on debian systems: apt-get install python-nose): %s\n" % e)
sys.exit(1) sys.exit(1)
try:
import mapnik
except ImportError:
print '\x1b[31m✘\x1b[0m (\x1b[34m%s\x1b[0m)' % 'import mapnik failed - tests require python bindings'
sys.exit(0)
from python_tests.utilities import TodoPlugin from python_tests.utilities import TodoPlugin
from nose.plugins.doctests import Doctest from nose.plugins.doctests import Doctest

View file

@ -1,11 +1,17 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import mapnik import sys
mapnik.logger.set_severity(mapnik.severity_type.None)
try:
import mapnik
mapnik.logger.set_severity(mapnik.severity_type.None)
#mapnik.logger.set_severity(mapnik.severity_type.Debug)
except ImportError:
print '\x1b[31m✘\x1b[0m (\x1b[34m%s\x1b[0m)' % 'import mapnik failed - tests require python bindings'
sys.exit(0)
import shutil import shutil
import sys
import os.path import os.path
from compare import compare, compare_grids from compare import compare, compare_grids