Skip if PYLAST_USERNAME etc. env vars missing

This commit is contained in:
hugovk 2015-01-08 11:14:40 +02:00
parent 882e749331
commit da26531c87

View file

@ -3,6 +3,7 @@
Integration (not unit) tests for pylast.py Integration (not unit) tests for pylast.py
""" """
import os import os
import pytest
from random import choice from random import choice
import sys import sys
import time import time
@ -19,10 +20,13 @@ def load_secrets():
doc = yaml.load(f) doc = yaml.load(f)
else: else:
doc = {} doc = {}
try:
doc["username"] = os.environ['PYLAST_USERNAME'].strip() doc["username"] = os.environ['PYLAST_USERNAME'].strip()
doc["password_hash"] = os.environ['PYLAST_PASSWORD_HASH'].strip() doc["password_hash"] = os.environ['PYLAST_PASSWORD_HASH'].strip()
doc["api_key"] = os.environ['PYLAST_API_KEY'].strip() doc["api_key"] = os.environ['PYLAST_API_KEY'].strip()
doc["api_secret"] = os.environ['PYLAST_API_SECRET'].strip() doc["api_secret"] = os.environ['PYLAST_API_SECRET'].strip()
except KeyError:
pytest.skip("Missing environment variables: PYLAST_USERNAME etc.")
return doc return doc