Beispiel #1
0
def test_main_stdlib_module():
    """
    This test makes sure that the module is really searched within the sunpy
    package.
    """
    with pytest.raises(ValueError):
        sunpy.self_test(package='random')
Beispiel #2
0
def test_main_stdlib_module():
    """This test makes sure that the module is really searched within the
    sunpy package.

    """
    with pytest.raises(ValueError):
        sunpy.self_test(package='random')
Beispiel #3
0
def test_main_include_remote_data(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(package='map', online=True)
    assert args in ([
        os.path.join('sunpy', 'map'), '--remote-data=any', '-m', 'not figure'
    ], [
        os.path.join(root_dir, 'map'), '--remote-data=any', '-m', 'not figure'
    ])
Beispiel #4
0
def test_main_coverage(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(coverage=True)
    for a in args:
        assert a in [root_dir, 'sunpy', '--cov', '--cov-config', '-m',
                     'not figure',
                     os.path.join(root_dir, 'tests', 'coveragerc'),
                     os.path.join('sunpy', 'tests', 'coveragerc')]
Beispiel #5
0
def test_main_coverage_report_html(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(coverage=True, cov_report=True)
    for a in args:
        assert a in [
            root_dir, 'sunpy', '--cov', '--cov-config', '-m', 'not figure',
            os.path.join(root_dir, 'tests', 'coveragerc'),
            os.path.join('sunpy', 'tests', 'coveragerc'), '--cov-report'
        ]
Beispiel #6
0
def test_main_submodule_jsoc(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(package='net.jsoc')
    assert args in ([
        os.path.join('sunpy', 'net', 'jsoc'), '-m', 'not figure'
    ], [os.path.join(root_dir, 'net', 'jsoc'), '-m', 'not figure'])
Beispiel #7
0
def test_main_noargs(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test()
    assert args in (['sunpy', '-m',
                     'not figure'], [root_dir, '-m', 'not figure'])
Beispiel #8
0
def test_main_nonexisting_module():
    with pytest.raises(ValueError):
        sunpy.self_test(package='doesnotexist')
Beispiel #9
0
def test_main_figures(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(figure=True)
    assert args in (['sunpy'],
                    [root_dir])
Beispiel #10
0
def test_main_only_remote_data(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(package='map', online_only=True)
    assert args in ([os.path.join('sunpy', 'map'), '-k remote_data', '--remote-data=any', '-m', 'not figure'],
                    [os.path.join(root_dir, 'map'), '-k remote_data', '--remote-data=any', '-m', 'not figure'])
Beispiel #11
0
def test_main_exclude_remote_data(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(package='map', online=False)
    assert args in ([os.path.join('sunpy', 'map'), '-m', 'not figure'],
                    [os.path.join(root_dir, 'map'), '-m', 'not figure'])
Beispiel #12
0
def test_main_submodule_jsoc(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(package='net.jsoc')
    assert args in ([os.path.join('sunpy', 'net', 'jsoc'), '-m', 'not figure'],
                    [os.path.join(root_dir, 'net', 'jsoc'), '-m', 'not figure'])
Beispiel #13
0
def test_main_noargs(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test()
    assert args in (['sunpy', '-m', 'not figure'],
                    [root_dir, '-m', 'not figure'])
Beispiel #14
0
def test_main_nonexisting_module():
    with pytest.raises(ValueError):
        sunpy.self_test(package='doesnotexist')
Beispiel #15
0
def test_main_figures(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(figure=True)
    assert args in (['sunpy'], [root_dir])
Beispiel #16
0
def test_main_figure_dir(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(figure_only=True, figure_dir=".")
    assert args in (['sunpy', '--figure_dir', '.', '-m', 'figure'],
                    [root_dir, '--figure_dir', '.', '-m', 'figure'])
Beispiel #17
0
def test_main_figure_only(monkeypatch):
    monkeypatch.setattr(pytest, 'main', lambda args, **kwargs: args)
    args = sunpy.self_test(figure_only=True)
    assert args in (['sunpy', '-m', 'figure'], [root_dir, '-m', 'figure'])
Beispiel #18
0
import os
import sys

# Force OpenBLAS to use a single thread to prevent image-rotation
# test failures on macOS. See https://github.com/sunpy/sunpy/issues/4290
# for more information.
os.environ['OMP_NUM_THREADS'] = '1'

import sunpy

sys.exit(sunpy.self_test())