Skip to content

Commit 64962a0

Browse files
committed
test: Move NVD queries to LONG_TESTS due to rate limits
1 parent 8c1f773 commit 64962a0

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/test_cvedb.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import datetime
55
import shutil
66
import tempfile
7+
from test.utils import LONG_TESTS
78

89
import aiohttp
910
import pytest
@@ -21,6 +22,9 @@ def teardown_class(cls):
2122
shutil.rmtree(cls.cvedb.cachedir)
2223

2324
@pytest.mark.asyncio
25+
@pytest.mark.skipif(
26+
LONG_TESTS() != 1, reason="Skipping NVD calls due to rate limits"
27+
)
2428
async def test_00_getmeta(self):
2529
connector = aiohttp.TCPConnector(limit_per_host=19)
2630
async with aiohttp.ClientSession(
@@ -33,6 +37,9 @@ async def test_00_getmeta(self):
3337
assert "sha256" in meta
3438

3539
@pytest.mark.asyncio
40+
@pytest.mark.skipif(
41+
LONG_TESTS() != 1, reason="Skipping NVD calls due to rate limits"
42+
)
3643
async def test_01_nist_scrape(self):
3744
async with aiohttp.ClientSession(trust_env=True) as session:
3845
jsonshas = await self.cvedb.nist_scrape(session)
@@ -42,6 +49,9 @@ async def test_01_nist_scrape(self):
4249
)
4350

4451
@pytest.mark.asyncio
52+
@pytest.mark.skipif(
53+
LONG_TESTS() != 1, reason="Skipping NVD calls due to rate limits"
54+
)
4555
async def test_02_cache_update(self):
4656
async with aiohttp.ClientSession(trust_env=True) as session:
4757
jsonurl, meta = await self.cvedb.getmeta(
@@ -51,6 +61,9 @@ async def test_02_cache_update(self):
5161
await self.cvedb.cache_update(session, jsonurl, meta["sha256"])
5262

5363
@pytest.mark.asyncio
64+
@pytest.mark.skipif(
65+
LONG_TESTS() != 1, reason="Skipping NVD calls due to rate limits"
66+
)
5467
async def test_03_refresh(self):
5568
await self.cvedb.refresh()
5669
years = self.cvedb.nvd_years()

0 commit comments

Comments
 (0)