Skip to content

Commit

Permalink
Including libmseed test data in ObsPy package.
Browse files Browse the repository at this point in the history
  • Loading branch information
krischer committed Oct 13, 2016
1 parent a2c7101 commit 89eb4a4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 5 additions & 3 deletions obspy/io/mseed/tests/test_mseed_reading_and_writing.py
Expand Up @@ -1430,7 +1430,8 @@ def assert_valid(filename, reference, test_type):
# And all the test data.
test_files = glob.glob(os.path.join(folder, "data", "*.mseed"))
# And their paths relative to the test folder.
rel_test_files = [os.path.relpath(_i, folder) for _i in test_files]
rel_test_files = [os.path.normpath(os.path.relpath(_i, folder))
for _i in test_files]

count = 0

Expand All @@ -1452,12 +1453,13 @@ def assert_valid(filename, reference, test_type):
elif content.endswith(".mseed"):
test_type = "failure"

test_file = [_i for _i in rel_test_files if _i in content]
test_file = [_i for _i in rel_test_files
if os.path.basename(_i) in content]
if not test_file:
continue
self.assertEqual(len(test_file), 1, msg=str(test_file))

test_file = os.path.join(folder, test_file[0])
test_file = os.path.normpath(os.path.join(folder, test_file[0]))
ref_file = filename + ".ref"

assert_valid(test_file, ref_file, test_type)
Expand Down
12 changes: 12 additions & 0 deletions setup.py
Expand Up @@ -615,6 +615,18 @@ def add_data_files(config):
if folder in dirs:
dirs.remove(folder)

# Force include the contents of some directories.
FORCE_INCLUDE_DIRS = [
os.path.join(SETUP_DIRECTORY, 'obspy', 'io', 'mseed', 'src',
'libmseed', 'test')]

for folder in FORCE_INCLUDE_DIRS:
for root, _, files in os.walk(folder):
for filename in files:
config.add_data_files(
os.path.relpath(os.path.join(root, filename),
SETUP_DIRECTORY))


# Auto-generate man pages from --help output
class Help2ManBuild(build):
Expand Down

0 comments on commit 89eb4a4

Please sign in to comment.