From b0215627ac5c964cb4d359115d4ec38a6e46c3e1 Mon Sep 17 00:00:00 2001 From: Ellis Valentiner Date: Thu, 22 Mar 2018 14:14:27 -0400 Subject: [PATCH] Skip tests if API key is missing --- test/runtests.jl | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 6c46bc5..fde77b8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,11 +1,16 @@ using DarkSky using Base.Test -response = forecast(42.3601, -71.0589); -@test typeof(response) === DarkSky.DarkSkyResponse -response = forecast(42.3601, -71.0589, exclude=["currently"], extend="hourly"); -@test typeof(response) === DarkSky.DarkSkyResponse -response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0)); -@test typeof(response) === DarkSky.DarkSkyResponse -response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0), lang="es", units="si", exclude=["minutely"]); -@test typeof(response) === DarkSky.DarkSkyResponse +if haskey(ENV, "DARKSKY_API_KEY") + info("Dark Sky API key was found in your system environment variables, running tests...") + response = forecast(42.3601, -71.0589); + @test typeof(response) === DarkSky.DarkSkyResponse + response = forecast(42.3601, -71.0589, exclude=["currently"], extend="hourly"); + @test typeof(response) === DarkSky.DarkSkyResponse + response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0)); + @test typeof(response) === DarkSky.DarkSkyResponse + response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0), lang="es", units="si", exclude=["minutely"]); + @test typeof(response) === DarkSky.DarkSkyResponse +else + warn("Dark Sky API key was not found in your system environment variables, skipping tests...") +end