Skip to content

Commit

Permalink
Mark linter tests and tests which require network (ros-infrastructure…
Browse files Browse the repository at this point in the history
…#884)

Marking tests appropriately will allow us to be more selective about
what tests are run.
  • Loading branch information
cottsay authored Jun 24, 2022
1 parent 4b52357 commit 275cdeb
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
filterwarnings =
ignore:deprecated.( use rosdistro instead| see REP137 and rosdistro):UserWarning:rosdep2
junit_suite_name = rosdep
markers =
flake8
linter
online

[coverage:run]
source = rosdep2
3 changes: 3 additions & 0 deletions test/test_flake8.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
import sys

from flake8.api.legacy import get_style_guide
import pytest


@pytest.mark.flake8
@pytest.mark.linter
def test_flake8():
style_guide = get_style_guide(
exclude=['conf.py'],
Expand Down
2 changes: 2 additions & 0 deletions test/test_rosdep_catkin_support.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from rosdep2.catkin_support import get_installer, get_catkin_view, ValidationFailed, resolve_for_os

from rosdep2.platforms.debian import APT_INSTALLER
import pytest


@pytest.mark.online
def test_workflow():
try:
installer = get_installer(APT_INSTALLER)
Expand Down
5 changes: 5 additions & 0 deletions test/test_rosdep_gbpdistro_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@
except ImportError:
from urllib2 import urlopen

import pytest


def get_test_dir():
return os.path.abspath(os.path.join(os.path.dirname(__file__),
'sources.list.d'))


@pytest.mark.online
def test_url_constants():
from rosdep2.gbpdistro_support import FUERTE_GBPDISTRO_URL
for url_name, url in [
Expand All @@ -49,6 +52,7 @@ def test_url_constants():
assert False, 'URL [%s][%s] failed to download' % (url_name, url)


@pytest.mark.online
def test_get_gbprepo_as_rosdep_data():
from rosdep2.rosdistrohelper import get_index
from rosdep2.gbpdistro_support import get_gbprepo_as_rosdep_data
Expand All @@ -67,6 +71,7 @@ def test_get_gbprepo_as_rosdep_data():
pass


@pytest.mark.online
def test_download_gbpdistro_as_rosdep_data():
from rosdep2.gbpdistro_support import download_gbpdistro_as_rosdep_data
from rosdep2.gbpdistro_support import FUERTE_GBPDISTRO_URL
Expand Down
4 changes: 4 additions & 0 deletions test/test_rosdep_rep3.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@
except ImportError:
from urllib2 import urlopen

import pytest


def get_test_dir():
return os.path.abspath(os.path.join(os.path.dirname(__file__), 'sources.list.d'))


@pytest.mark.online
def test_url_constants():
from rosdep2.rep3 import REP3_TARGETS_URL
for url_name, url in [('REP3_TARGETS_URL', REP3_TARGETS_URL),
Expand All @@ -48,6 +51,7 @@ def test_url_constants():
assert False, 'URL [%s][%s] failed to download' % (url_name, url)


@pytest.mark.online
def test_download_targets_data():
from rosdep2.rep3 import download_targets_data, REP3_TARGETS_URL
from rosdep2 import DownloadFailure
Expand Down
3 changes: 3 additions & 0 deletions test/test_rosdep_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
# Author Ken Conley/[email protected]

import os
import pytest
import yaml

rep122_install_command = """#!/bin/bash
Expand Down Expand Up @@ -300,12 +301,14 @@ def test_download_rdmanifest():
pass


@pytest.mark.online
def test_install_from_file():
from rosdep2.platforms.source import install_from_file
f = os.path.join(get_test_dir(), 'noop-not-installed.rdmanifest')
install_from_file(f)


@pytest.mark.online
def test_install_source():
from rosdep2.platforms.source import install_source, SourceInstall
resolved = SourceInstall()
Expand Down
7 changes: 7 additions & 0 deletions test/test_rosdep_sources_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from urllib2 import urlopen
from urllib2 import URLError

import pytest
import rospkg.distro
import rosdep2.sources_list

Expand All @@ -53,6 +54,7 @@ def test_get_sources_cache_dir():
assert rosdep2.sources_list.get_sources_cache_dir()


@pytest.mark.online
def test_url_constants():
from rosdep2.sources_list import DEFAULT_SOURCES_LIST_URL
for url_name, url in [('DEFAULT_SOURCES_LIST_URL', DEFAULT_SOURCES_LIST_URL)]:
Expand All @@ -64,6 +66,7 @@ def test_url_constants():
assert False, 'URL [%s][%s] failed to download' % (url_name, url)


@pytest.mark.online
def test_download_default_sources_list():
from rosdep2.sources_list import download_default_sources_list
data = download_default_sources_list()
Expand Down Expand Up @@ -193,6 +196,7 @@ def test_write_cache_file():
assert {'data': 1} == pickle.loads(f.read())


@pytest.mark.online
def test_update_sources_list():
from rosdep2.sources_list import update_sources_list, InvalidData, compute_filename_hash, PICKLE_CACHE_EXT
try:
Expand Down Expand Up @@ -245,6 +249,7 @@ def error_handler(loc, e):
assert expected == index, '\n[%s]\nvs\n[%s]' % (expected, index)


@pytest.mark.online
def test_load_cached_sources_list():
from rosdep2.sources_list import load_cached_sources_list, update_sources_list
tempdir = tempfile.mkdtemp()
Expand Down Expand Up @@ -296,6 +301,7 @@ def test_DataSourceMatcher():
assert not matcher.matches(data_source)


@pytest.mark.online
def test_download_rosdep_data():
from rosdep2.sources_list import download_rosdep_data
from rosdep2 import DownloadFailure
Expand Down Expand Up @@ -411,6 +417,7 @@ def test_DataSourceMatcher_create_default():
assert not matcher.matches(data_source)


@pytest.mark.online
def test_SourcesListLoader_create_default():
from rosdep2.sources_list import update_sources_list, SourcesListLoader, DataSourceMatcher
# create temp dir for holding sources cache
Expand Down

0 comments on commit 275cdeb

Please sign in to comment.