Code Duplication    Length = 14-20 lines in 2 locations

tests/test_configurator.py 2 locations

@@ 55-74 (lines=20) @@
52
        config_url = 'http://107.21.150.202:5984/config/tailchaser-test'
53
54
    o = O()
55
    MyConfig.configure(o)
56
    assert (o.dont_backfill is False)
57
    assert (o.read_period == 2)
58
59
60
def test_config_from_python():
61
    code = """
62
SZ=10
63
SIG_SZ=10*SZ
64
class Tailer:
65
    READ_PERIOD = 1
66
"""
67
68
    class MyConfig(Configurable):
69
        body = 'hello'
70
        objectType = 'Nothing'
71
72
    with tempfile.NamedTemporaryFile(suffix='.py', delete=False) as python_file:
73
        name = python_file.name
74
        python_file.write(code)
75
76
    o = O()
77
    MyConfig.configure(o, config_file=name)
@@ 26-39 (lines=14) @@
23
24
    o = O()
25
    MyConfig.configure(o, timeouut=1, highwater=.7)
26
    assert (o.watermark == MyConfig.watermark)
27
    assert (o.timeout == 1)
28
    assert (o.highwater == .7)
29
30
31
def test_config_by_json():
32
    class MyConfig(Configurable):
33
        timeout = 1
34
        highwater = .4
35
        watermark = 'tv'
36
37
    o = O()
38
    with tempfile.NamedTemporaryFile(suffix='.json', delete=False) as json_file:
39
        name = json_file.name
40
        json.dump(dict(timeouut=1, highwater=.7), json_file)
41
    MyConfig.configure(o, config_file=name)
42
    assert (o.watermark == MyConfig.watermark)