1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

skip example config tests if files are not available (#730)

This commit is contained in:
Mike Fährmann 2020-05-08 21:48:47 +02:00
parent 65b1cb7acd
commit 8f2c1da041
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -14,7 +14,8 @@ import unittest
import json
import tempfile
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
ROOTDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, ROOTDIR)
from gallery_dl import config # noqa E402
@ -156,10 +157,12 @@ class TestConfigFiles(unittest.TestCase):
@staticmethod
def _load(name):
rootdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
path = os.path.join(rootdir, "docs", name)
with open(path) as fp:
return json.load(fp)
path = os.path.join(ROOTDIR, "docs", name)
try:
with open(path) as fp:
return json.load(fp)
except FileNotFoundError:
raise unittest.SkipTest(path + " not available")
if __name__ == '__main__':