Does this work for Windows config file paths?
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import configparser
|
||||
import itertools
|
||||
import os
|
||||
import platform
|
||||
import random
|
||||
import re
|
||||
|
||||
@@ -39,6 +40,9 @@ FREQUENCY = FrequencyParamType()
|
||||
|
||||
|
||||
def config_file():
|
||||
if platform.system() == 'Windows':
|
||||
return os.path.join(os.getenv('APPDATA'), 'sucks.conf')
|
||||
else:
|
||||
return os.path.expanduser('~/.config/sucks.conf')
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,20 @@ from nose.tools import *
|
||||
from sucks.cli import *
|
||||
|
||||
|
||||
def test_config_file_name():
|
||||
if platform.system() == 'Windows':
|
||||
print(config_file())
|
||||
assert_true(re.match(r'[A-Z]:\\.+\\\w+\\AppData\\sucks.conf', config_file()))
|
||||
else:
|
||||
assert_true(re.match(r'/.+/\w+/.config/sucks.conf', config_file()))
|
||||
|
||||
|
||||
# def test_write_and_read_config():
|
||||
# config1 = {'a':1, 'b':2}
|
||||
# write_config(config1)
|
||||
# config2 = read_config()
|
||||
# assert_equals(config1, config2)
|
||||
|
||||
def test_frequency_param_type():
|
||||
t = FREQUENCY
|
||||
assert_equals(t.convert('0', None, None), 0)
|
||||
|
||||
Reference in New Issue
Block a user