Skip to content

Commit 6f59a38

Browse files
author
David Noble
committed
Test fix for Windows
1 parent 09c2e09 commit 6f59a38

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

splunklib/searchcommands/search_command_internals.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def write(self, output_file):
174174

175175
line_ending = '\n' if os.name == 'nt' else '\r\n'
176176

177+
177178
class SearchCommandParser(object):
178179
""" Parses the arguments to a search command
179180

tests/test_searchcommands_app.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,20 @@ def setUp(self):
211211
def test_command_parser(self):
212212
from splunklib.searchcommands.search_command_internals import \
213213
SearchCommandParser
214+
from json import JSONEncoder
214215

215216
parser = SearchCommandParser()
217+
encoder = JSONEncoder()
218+
file_path = TestSearchCommandsApp._data_file(os.path.join('input', 'counts.csv'))
219+
216220
command = StubbedStreamingCommand()
217-
file_path = TestSearchCommandsApp._data_file('input/counts.csv')
221+
218222
parser.parse(
219223
[
220224
'boolean=true',
221225
'duration=00:00:10',
222226
'fieldname=word_count',
223-
'file=%s' % file_path,
227+
'file=%s' % encoder.encode(file_path),
224228
'integer=10',
225229
'optionname=foo_bar',
226230
'regularexpression="\\\\w+"',
@@ -232,7 +236,7 @@ def test_command_parser(self):
232236
command)
233237
command_line = str(command)
234238
self.assertEqual(
235-
'stubbedstreaming boolean=true duration=10 fieldname="word_count" file="%s" integer=10 optionname="foo_bar" regularexpression="\\\\w+" set="foo" field_1 field_2 field_3' % file_path,
239+
'stubbedstreaming boolean=true duration=10 fieldname="word_count" file=%s integer=10 optionname="foo_bar" regularexpression="\\\\w+" set="foo" field_1 field_2 field_3' % encoder.encode(file_path),
236240
command_line)
237241
return
238242

0 commit comments

Comments
 (0)