Example #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')
Example #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')
Example #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'
    ])
Example #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')]
Example #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'
        ]
Example #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'])
Example #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'])
Example #8
0
def test_main_nonexisting_module():
    with pytest.raises(ValueError):
        sunpy.self_test(package='doesnotexist')
Example #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])
Example #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'])
Example #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'])
Example #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'])
Example #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'])
Example #14
0
def test_main_nonexisting_module():
    with pytest.raises(ValueError):
        sunpy.self_test(package='doesnotexist')
Example #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])
Example #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'])
Example #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'])
Example #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())