File: test_utils.py

package info (click to toggle)
tomahawk 0.7.1-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 484 kB
  • sloc: python: 1,921; makefile: 153; sh: 3
file content (35 lines) | stat: -rw-r--r-- 853 bytes parent folder | download | duplicates (3)
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
from six import print_
import os
from tests.internal import utils
utils.append_home_to_path(__file__)

from tomahawk.utils import (
    get_options_from_conf
)

def test_00_get_options_from_conf(tmpdir):
    path = os.path.join(str(tmpdir), 'tomahawk.conf')
    conf = open(path, 'w')
    try:
        conf.write("""
[tomahawk]
options = --verify-output
""".strip())
    finally:
        conf.close()
    conf_options = get_options_from_conf('tomahawk', path)
    assert conf_options == [ '--verify-output' ]

def test_01_get_options_from_conf_no_options(tmpdir):
    path = os.path.join(str(tmpdir), 'tomahawk.conf')
    conf = open(path, 'w')
    try:
        conf.write("""
[tomahawk]
# options = --verify-output
""".strip())
    finally:
        conf.close()
    conf_options = get_options_from_conf('tomahawk', path)
    assert conf_options == []