/usr/share/pyshared/netaddr/tests/__init__.py is in python-netaddr 0.7.5-4build2.
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 57 58 59 60 61 62 63 64 65 | #!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2008-2010, David P. D. Moss. All rights reserved.
#
# Released under the BSD license. See the LICENSE file for details.
#-----------------------------------------------------------------------------
"""Runs all netaddr unit tests."""
from os.path import abspath, basename, dirname, join as pathjoin
import sys
import glob
import doctest
import unittest
sys.path.insert(0, abspath(pathjoin(dirname(__file__), '..', '..')))
#-----------------------------------------------------------------------------
def test_suite_all():
test_dirs = [
'ip',
'eui',
'strategy',
'core'
]
base_path = abspath(pathjoin(dirname(__file__), '..'))
py_ver_dir = '2.x'
if sys.version_info[0] == 3:
py_ver_dir = '3.x'
# Gather list of files containing tests.
test_files = []
for entry in test_dirs:
test_path = pathjoin(base_path, "tests", py_ver_dir, entry, "*.txt")
files = glob.glob(test_path)
test_files.extend(files)
sys.stdout.write('testdir: %s\n' % '\n'.join(test_files))
# Add anything to the skiplist that we want to leave out.
skiplist = []
# Exclude any entries from the skip list.
test_files = [t for t in test_files if basename(t) not in skiplist]
# Build and return a complete unittest test suite.
suite = unittest.TestSuite()
for test_file in test_files:
doctest_suite = doctest.DocFileSuite(test_file,
optionflags=doctest.ELLIPSIS, module_relative=False)
suite.addTest(doctest_suite)
return suite
#-----------------------------------------------------------------------------
def run():
runner = unittest.TextTestRunner()
runner.run(test_suite_all())
#-----------------------------------------------------------------------------
if __name__ == "__main__":
run()
|