Skip to content

Commit

Permalink
gwsumm.tests: update config references
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmmacleod committed Mar 19, 2019
1 parent f288303 commit 2ec602d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
25 changes: 13 additions & 12 deletions gwsumm/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from collections import OrderedDict

from six.moves import StringIO
from six.moves.configparser import (DEFAULTSECT, ConfigParser)

import pytest

Expand Down Expand Up @@ -57,7 +58,7 @@


def assert_configparser_equal(a, b):
for sect in set([config.DEFAULTSECT] + list(a.sections()) +
for sect in set([DEFAULTSECT] + list(a.sections()) +
list(b.sections())):
assert list(a.items(sect)) == list(b.items(sect))

Expand Down Expand Up @@ -118,7 +119,7 @@ def test_from_configparser(self, cnfg):
assert copy is cnfg

# check that base ConfigParser gets converted to GWSummConfigParser
cp = config.ConfigParser()
cp = ConfigParser()
try:
cp.read_file(TEST_CONFIG)
except AttributeError:
Expand All @@ -144,19 +145,19 @@ def test_interpolate_section_names(self, cnfg):
def test_set_ifo_options(self, ifo, obs, exp):
cp = self.new()
cp.set_ifo_options(ifo, observatory=obs)
assert cp.get(config.DEFAULTSECT, 'IFO') == ifo.upper()
assert cp.get(config.DEFAULTSECT, 'ifo') == ifo.lower()
assert cp.get(config.DEFAULTSECT, 'SITE') == ifo[0].upper()
assert cp.get(config.DEFAULTSECT, 'site') == ifo[0].lower()
assert cp.get(config.DEFAULTSECT, 'observatory') == exp
assert cp.get(DEFAULTSECT, 'IFO') == ifo.upper()
assert cp.get(DEFAULTSECT, 'ifo') == ifo.lower()
assert cp.get(DEFAULTSECT, 'SITE') == ifo[0].upper()
assert cp.get(DEFAULTSECT, 'site') == ifo[0].lower()
assert cp.get(DEFAULTSECT, 'observatory') == exp

def test_set_date_options(self):
cp = self.new()
cp.set_date_options(0, 100)
assert cp.get(config.DEFAULTSECT, 'gps-start-time') == '0'
assert cp.get(config.DEFAULTSECT, 'gps-end-time') == '100'
assert cp.get(config.DEFAULTSECT, 'yyyy') == '1980'
assert cp.get(config.DEFAULTSECT, 'duration') == '100'
assert cp.get(DEFAULTSECT, 'gps-start-time') == '0'
assert cp.get(DEFAULTSECT, 'gps-end-time') == '100'
assert cp.get(DEFAULTSECT, 'yyyy') == '1980'
assert cp.get(DEFAULTSECT, 'duration') == '100'

def test_load_rcParams(self):
# check empty config doesn't cause havoc
Expand Down Expand Up @@ -209,7 +210,7 @@ def test_load_channels(self):
assert c.frametype == 'X1_TEST'

# test with interpolation
cp.set(config.DEFAULTSECT, 'IFO', 'X1')
cp.set(DEFAULTSECT, 'IFO', 'X1')
cp.add_section('%(IFO)s:TEST-CHANNEL_2')
cp.set('%(IFO)s:TEST-CHANNEL_2', 'resample', '128')
cp.interpolate_section_names(IFO='X1')
Expand Down
6 changes: 5 additions & 1 deletion gwsumm/tests/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@

import os

try:
from configparser import ConfigParser
except ImportError: # python < 3
from ConfigParser import ConfigParser

from matplotlib import use
use('agg') # noqa

Expand All @@ -35,7 +40,6 @@
from gwpy.segments import Segment

from gwsumm import plot as gwsumm_plot
from gwsumm.config import ConfigParser
from gwsumm.channels import get_channel

__author__ = 'Duncan Macleod <duncan.macleod@ligo.org>'
Expand Down

0 comments on commit 2ec602d

Please sign in to comment.