Skip to content

Commit

Permalink
ALAMP-94 updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
YingzhiGou committed Oct 24, 2017
1 parent 7fd387e commit d04233a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .coveragerc
Expand Up @@ -16,8 +16,7 @@ exclude_lines =
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError
raise NotImplemented.*
raise .*Exception.*
raise .*Error.*

Expand Down
23 changes: 11 additions & 12 deletions tests/core/test_ediCollection.py
@@ -1,6 +1,7 @@
import glob
import os
import unittest
from Tkinter import TclError
from unittest import TestCase

import matplotlib
Expand Down Expand Up @@ -91,15 +92,18 @@ def test_get_periods_by_stats(self):

def test_plot_stations(self):
self.edi_collection.plot_stations()
plt.pause(1)
if plt.isinteractive():
plt.pause(1)

def test_display_on_basemap(self):
self.edi_collection.display_on_basemap()
plt.pause(1)
if plt.isinteractive():
plt.pause(1)

def test_display_on_image(self):
self.edi_collection.display_on_image()
plt.pause(1)
if plt.isinteractive():
plt.pause(1)

def test_create_mt_station_gdf(self):
path = os.path.join(self._temp_dir, self.__class__.__name__ + "_mt_station_gdf")
Expand All @@ -126,13 +130,13 @@ def test_create_phase_tensor_csv_with_image(self):
self.edi_collection.create_phase_tensor_csv_with_image(path2)


class TsetFromFile(_BaseTest):
class _TsetFromFile(_BaseTest):
def setUp(self):
_BaseTest.setUp(self)
self.edi_collection = EdiCollection(self.edi_files)


class TestFromMTObj(_BaseTest):
class _TestFromMTObj(_BaseTest):
def setUp(self):
_BaseTest.setUp(self)
mt_objs = [MT(edi_file) for edi_file in self.edi_files]
Expand All @@ -142,15 +146,10 @@ def setUp(self):
for edi_path in edi_paths:
if os.path.isdir(edi_path):
cls_name = "TestEdiCollectionFromFile_%s" % (os.path.basename(edi_path))
globals()[cls_name] = type(cls_name, (TsetFromFile, unittest.TestCase), {
globals()[cls_name] = type(cls_name, (_TsetFromFile, unittest.TestCase), {
"edi_path": edi_path
})
cls_name = "TestEdiCollectionFromMTObj_%s" % (os.path.basename(edi_path))
globals()[cls_name] = type(cls_name, (TestFromMTObj, unittest.TestCase), {
globals()[cls_name] = type(cls_name, (_TestFromMTObj, unittest.TestCase), {
"edi_path": edi_path
})

if 'TsetFromFile' in globals():
del globals()['TsetFromFile']
if 'TestFromMTObj' in globals():
del globals()['TestFromMTObj']

0 comments on commit d04233a

Please sign in to comment.