4
4
import datetime
5
5
import shutil
6
6
import tempfile
7
+ from test .utils import LONG_TESTS
7
8
8
9
import aiohttp
9
10
import pytest
@@ -21,6 +22,9 @@ def teardown_class(cls):
21
22
shutil .rmtree (cls .cvedb .cachedir )
22
23
23
24
@pytest .mark .asyncio
25
+ @pytest .mark .skipif (
26
+ LONG_TESTS () != 1 , reason = "Skipping NVD calls due to rate limits"
27
+ )
24
28
async def test_00_getmeta (self ):
25
29
connector = aiohttp .TCPConnector (limit_per_host = 19 )
26
30
async with aiohttp .ClientSession (
@@ -33,6 +37,9 @@ async def test_00_getmeta(self):
33
37
assert "sha256" in meta
34
38
35
39
@pytest .mark .asyncio
40
+ @pytest .mark .skipif (
41
+ LONG_TESTS () != 1 , reason = "Skipping NVD calls due to rate limits"
42
+ )
36
43
async def test_01_nist_scrape (self ):
37
44
async with aiohttp .ClientSession (trust_env = True ) as session :
38
45
jsonshas = await self .cvedb .nist_scrape (session )
@@ -42,6 +49,9 @@ async def test_01_nist_scrape(self):
42
49
)
43
50
44
51
@pytest .mark .asyncio
52
+ @pytest .mark .skipif (
53
+ LONG_TESTS () != 1 , reason = "Skipping NVD calls due to rate limits"
54
+ )
45
55
async def test_02_cache_update (self ):
46
56
async with aiohttp .ClientSession (trust_env = True ) as session :
47
57
jsonurl , meta = await self .cvedb .getmeta (
@@ -51,6 +61,9 @@ async def test_02_cache_update(self):
51
61
await self .cvedb .cache_update (session , jsonurl , meta ["sha256" ])
52
62
53
63
@pytest .mark .asyncio
64
+ @pytest .mark .skipif (
65
+ LONG_TESTS () != 1 , reason = "Skipping NVD calls due to rate limits"
66
+ )
54
67
async def test_03_refresh (self ):
55
68
await self .cvedb .refresh ()
56
69
years = self .cvedb .nvd_years ()
0 commit comments