This file is indexed.

/usr/lib/python2.7/dist-packages/sunpy/conftest.py is in python-sunpy 0.6.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from functools import partial
import urllib2
import os
import tempfile
import json

import pytest

# Force MPL to use non-gui backends for testing.
try:
    import matplotlib
except ImportError:
    pass
else:
    matplotlib.use('Agg')

from sunpy.tests import hash

hash_library_original_len = len(hash.hash_library)

GOOGLE_URL = 'http://www.google.com'


def site_reachable(url):
    try:
        urllib2.urlopen(url, timeout=1)
    except urllib2.URLError:
        return False
    else:
        return True


is_online = partial(site_reachable, GOOGLE_URL)


def pytest_runtest_setup(item):
    """pytest hook to skip all tests that have the mark 'online' if the
    client is online (simply detected by checking whether http://www.google.com
    can be requested).

    """
    if isinstance(item, item.Function):
        if 'online' in item.keywords and not is_online():
            msg = 'skipping test {0} (reason: client seems to be offline)'
            pytest.skip(msg.format(item.name))

def pytest_unconfigure(config):
    #Check if additions have been made to the hash library
    if len(hash.hash_library) > hash_library_original_len:
        #Write the new hash library in JSON
        tempdir = tempfile.mkdtemp()
        hashfile = os.path.join(tempdir, hash.HASH_LIBRARY_NAME)
        with open(hashfile, 'wb') as outfile:
            json.dump(hash.hash_library, outfile, sort_keys=True, indent=4, separators=(',', ': '))
        print("The hash library has expanded and should be copied to sunpy/tests/")
        print("  " + hashfile)