Wrap code in main function
@@ -34,6 +34,7 @@ def requirement_missing(notebook):
return False
+def main():
if 'GAMMAPY_EXTRA' not in os.environ:
logging.info('GAMMAPY_EXTRA environment variable not set.')
logging.info('Running notebook tests requires gammapy-extra.')
@@ -48,7 +49,6 @@ except Exception as ex:
logging.error(ex)
sys.exit()
-
passed = True
yamlfile = get_notebooks()
dirnbs = Path('tutorials')
@@ -67,3 +67,7 @@ for notebook in yamlfile:
os.unlink('datasets')
assert passed
+
+
+if __name__ == '__main__':
+ main()
