From 25f7d4a3a144c9dde293fdcf797bee6a9e92576d Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 14:23:06 -0800 Subject: [PATCH 01/14] initial chenckin --- .vscode/launch.json | 67 +++++++++++++++++++ .vscode/settings.json | 13 ++++ .../searchcommands_app/package/lib/splunklib | 1 + 3 files changed, 81 insertions(+) create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 120000 examples/searchcommands_app/package/lib/splunklib diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..32418632e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,67 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File (Integrated Terminal)", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/setup.py", + "args": ["test"], + "console": "integratedTerminal" + }, + { + "name": "Python: Attach", + "type": "python", + "request": "attach", + "port": 5678, + "host": "localhost" + }, + { + "name": "Python: Module", + "type": "python", + "request": "launch", + "module": "enter-your-module-name-here", + "console": "integratedTerminal" + }, + { + "name": "Python: Django", + "type": "python", + "request": "launch", + "program": "${workspaceFolder}/manage.py", + "console": "integratedTerminal", + "args": [ + "runserver", + "--noreload", + "--nothreading" + ], + "django": true + }, + { + "name": "Python: Flask", + "type": "python", + "request": "launch", + "module": "flask", + "env": { + "FLASK_APP": "app.py" + }, + "args": [ + "run", + "--no-debugger", + "--no-reload" + ], + "jinja": true + }, + { + "name": "Python: Current File (External Terminal)", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "externalTerminal" + }, + + + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..9846e806d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "python.pythonPath": "/usr/bin/python", + "python.unitTest.unittestArgs": [ + "-v", + "-s", + "./tests", + "-p", + "test_*.py" + ], + "python.unitTest.pyTestEnabled": false, + "python.unitTest.nosetestsEnabled": false, + "python.unitTest.unittestEnabled": true +} \ No newline at end of file diff --git a/examples/searchcommands_app/package/lib/splunklib b/examples/searchcommands_app/package/lib/splunklib new file mode 120000 index 000000000..fdf5ebd7f --- /dev/null +++ b/examples/searchcommands_app/package/lib/splunklib @@ -0,0 +1 @@ +/Users/xcheng/repo/github/splunk-sdk-python/splunklib \ No newline at end of file From 2d2a66b574ca6e52404a521833bb984f30722da9 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 14:27:01 -0800 Subject: [PATCH 02/14] make changes --- .gitignore | 2 +- examples/searchcommands_app/setup.py | 12 ++++++------ setup.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 853591131..16ed57366 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ tests/searchcommands/data/app/app.log splunk_sdk.egg-info/ dist/ examples/searchcommands_app/package/default/commands.conf -examples/searchcommands_app/package/bin/packages +examples/searchcommands_app/package/lib/splunklib tests/searchcommands/apps/app_with_logging_configuration/*.log *.observed venv/ \ No newline at end of file diff --git a/examples/searchcommands_app/setup.py b/examples/searchcommands_app/setup.py index ab8d6cac4..052d64dad 100755 --- a/examples/searchcommands_app/setup.py +++ b/examples/searchcommands_app/setup.py @@ -88,7 +88,7 @@ def install_packages(app_root, distribution): if not requires: return - target = os.path.join(app_root, 'bin', 'packages') + target = os.path.join(app_root, 'lib', 'packages') if not os.path.isdir(target): os.mkdir(target) @@ -323,7 +323,7 @@ def run(self): message = 'Cannot create a link at "{}" because a file by that name already exists.'.format(target) raise SystemError(message) - packages = os.path.join(self.app_source, 'bin', 'packages') + packages = os.path.join(self.app_source, 'lib') if not os.path.isdir(packages): os.mkdir(packages) @@ -454,13 +454,13 @@ def run(self): 'Topic :: System :: Logging', 'Topic :: System :: Monitoring'], packages=[ - 'bin.packages.splunklib', 'bin.packages.splunklib.searchcommands' + 'lib.splunklib', 'lib.splunklib.searchcommands' ], package_dir={ - 'bin': os.path.join('package', 'bin'), - 'bin.packages': os.path.join('package', 'bin', 'packages'), + 'lib': os.path.join('package', 'lib'), + 'lib.splunklib': os.path.join('..', '..', 'splunklib'), 'bin.packages.splunklib': os.path.join('..', '..', 'splunklib'), - 'bin.packages.splunklib.searchcommands': os.path.join('..', '..', 'splunklib', 'searchcommands') + 'lib.splunklib.searchcommands': os.path.join('..', '..', 'splunklib', 'searchcommands') }, package_data={ 'bin': [ diff --git a/setup.py b/setup.py index 88ae73b5b..120cb0333 100755 --- a/setup.py +++ b/setup.py @@ -68,7 +68,7 @@ def run_test_suite_with_junit_output(): import unittest import xmlrunner original_cwd = os.path.abspath(os.getcwd()) - os.chdir('tests') + os.chdir('tests/searchcommands') suite = unittest.defaultTestLoader.discover('.') xmlrunner.XMLTestRunner(output='../test-reports').run(suite) os.chdir(original_cwd) From 470da6d444dbf3ff83bc50ecacb32b7f337b0387 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 14:42:23 -0800 Subject: [PATCH 03/14] pprint modules --- examples/searchcommands_app/package/bin/countmatches.py | 2 ++ setup.py | 2 +- tests/searchcommands/test_searchcommands_app.py | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/searchcommands_app/package/bin/countmatches.py b/examples/searchcommands_app/package/bin/countmatches.py index 03231d790..25455ae10 100755 --- a/examples/searchcommands_app/package/bin/countmatches.py +++ b/examples/searchcommands_app/package/bin/countmatches.py @@ -21,7 +21,9 @@ from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators import sys from splunklib import six +import pprint +pprint.pprint(sys.modules) @Configuration() class CountMatchesCommand(StreamingCommand): diff --git a/setup.py b/setup.py index 120cb0333..e527ae01a 100755 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ def _makeResult(self): self.stream, self.descriptions, self.verbosity) original_cwd = os.path.abspath(os.getcwd()) - os.chdir('tests') + os.chdir('tests/searchcommands') suite = unittest.defaultTestLoader.discover('.') runner = TrackingTextTestRunner(verbosity=2) runner.run(suite) diff --git a/tests/searchcommands/test_searchcommands_app.py b/tests/searchcommands/test_searchcommands_app.py index 0621f0310..3d0aa4fcc 100755 --- a/tests/searchcommands/test_searchcommands_app.py +++ b/tests/searchcommands/test_searchcommands_app.py @@ -43,6 +43,8 @@ import csv import io import os +import sys +import pprint try: from tests.searchcommands import project_root @@ -156,7 +158,7 @@ def setUp(self): TestCase.setUp(self) def test_countmatches_as_unit(self): - + pprint.pprint(sys.modules) expected, output, errors, exit_status = self._run_command('countmatches', action='getinfo', protocol=1) self.assertEqual(0, exit_status, msg=six.text_type(errors)) self.assertEqual('', errors) From 5e2191c5d402d8d9082addf2b653eec49034145c Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 14:49:38 -0800 Subject: [PATCH 04/14] print modules from command --- examples/searchcommands_app/package/bin/countmatches.py | 6 +++--- tests/searchcommands/test_searchcommands_app.py | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/searchcommands_app/package/bin/countmatches.py b/examples/searchcommands_app/package/bin/countmatches.py index 25455ae10..1740a7537 100755 --- a/examples/searchcommands_app/package/bin/countmatches.py +++ b/examples/searchcommands_app/package/bin/countmatches.py @@ -18,12 +18,12 @@ from __future__ import absolute_import, division, print_function, unicode_literals import app -from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators +import pprint import sys +pprint.pprint(sys.modules) +from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators from splunklib import six -import pprint -pprint.pprint(sys.modules) @Configuration() class CountMatchesCommand(StreamingCommand): diff --git a/tests/searchcommands/test_searchcommands_app.py b/tests/searchcommands/test_searchcommands_app.py index 3d0aa4fcc..12cf10ffc 100755 --- a/tests/searchcommands/test_searchcommands_app.py +++ b/tests/searchcommands/test_searchcommands_app.py @@ -44,7 +44,6 @@ import io import os import sys -import pprint try: from tests.searchcommands import project_root @@ -158,7 +157,6 @@ def setUp(self): TestCase.setUp(self) def test_countmatches_as_unit(self): - pprint.pprint(sys.modules) expected, output, errors, exit_status = self._run_command('countmatches', action='getinfo', protocol=1) self.assertEqual(0, exit_status, msg=six.text_type(errors)) self.assertEqual('', errors) From fb5b8628f007a4e435e9237df55342b5514c1d1e Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 15:04:47 -0800 Subject: [PATCH 05/14] pass env to subprocess --- examples/searchcommands_app/package/bin/countmatches.py | 4 +--- tests/searchcommands/test_searchcommands_app.py | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/searchcommands_app/package/bin/countmatches.py b/examples/searchcommands_app/package/bin/countmatches.py index 1740a7537..67f20b4d5 100755 --- a/examples/searchcommands_app/package/bin/countmatches.py +++ b/examples/searchcommands_app/package/bin/countmatches.py @@ -17,10 +17,8 @@ from __future__ import absolute_import, division, print_function, unicode_literals import app - -import pprint import sys -pprint.pprint(sys.modules) + from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators from splunklib import six diff --git a/tests/searchcommands/test_searchcommands_app.py b/tests/searchcommands/test_searchcommands_app.py index 12cf10ffc..23b13eedb 100755 --- a/tests/searchcommands/test_searchcommands_app.py +++ b/tests/searchcommands/test_searchcommands_app.py @@ -415,7 +415,8 @@ def _run_command(self, name, action=None, phase=None, protocol=2): break ofile.write(b) with io.open(uncompressed_file, 'rb') as ifile: - process = Popen(recording.get_args(command), stdin=ifile, stderr=PIPE, stdout=PIPE) + env = os.environ.copy() + process = Popen(recording.get_args(command), stdin=ifile, stderr=PIPE, stdout=PIPE, env=env) output, errors = process.communicate() with io.open(recording.output_file, 'rb') as ifile: expected = ifile.read() From ee264fe28103b687ac04fc0eb83382f5c22504b9 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 15:08:34 -0800 Subject: [PATCH 06/14] print pythonpath --- tests/searchcommands/test_searchcommands_app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/searchcommands/test_searchcommands_app.py b/tests/searchcommands/test_searchcommands_app.py index 23b13eedb..f3beab86d 100755 --- a/tests/searchcommands/test_searchcommands_app.py +++ b/tests/searchcommands/test_searchcommands_app.py @@ -44,6 +44,7 @@ import io import os import sys +import pprint try: from tests.searchcommands import project_root @@ -416,6 +417,7 @@ def _run_command(self, name, action=None, phase=None, protocol=2): ofile.write(b) with io.open(uncompressed_file, 'rb') as ifile: env = os.environ.copy() + pprint.pprint(env['PYTHONPATH']) process = Popen(recording.get_args(command), stdin=ifile, stderr=PIPE, stdout=PIPE, env=env) output, errors = process.communicate() with io.open(recording.output_file, 'rb') as ifile: From 20baf4bcacd6ea1e8aa219a9e8225dd0dcaf11ab Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 15:12:20 -0800 Subject: [PATCH 07/14] print os.environ --- tests/searchcommands/test_searchcommands_app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/searchcommands/test_searchcommands_app.py b/tests/searchcommands/test_searchcommands_app.py index f3beab86d..90c7b68aa 100755 --- a/tests/searchcommands/test_searchcommands_app.py +++ b/tests/searchcommands/test_searchcommands_app.py @@ -417,6 +417,7 @@ def _run_command(self, name, action=None, phase=None, protocol=2): ofile.write(b) with io.open(uncompressed_file, 'rb') as ifile: env = os.environ.copy() + pprint.pprint(env) pprint.pprint(env['PYTHONPATH']) process = Popen(recording.get_args(command), stdin=ifile, stderr=PIPE, stdout=PIPE, env=env) output, errors = process.communicate() From 57e9f1445f4116ced813f6febb342203c38905e8 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 15:19:05 -0800 Subject: [PATCH 08/14] update pythonpath --- tests/searchcommands/test_searchcommands_app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/searchcommands/test_searchcommands_app.py b/tests/searchcommands/test_searchcommands_app.py index 90c7b68aa..b2f0f6ed0 100755 --- a/tests/searchcommands/test_searchcommands_app.py +++ b/tests/searchcommands/test_searchcommands_app.py @@ -417,8 +417,9 @@ def _run_command(self, name, action=None, phase=None, protocol=2): ofile.write(b) with io.open(uncompressed_file, 'rb') as ifile: env = os.environ.copy() - pprint.pprint(env) - pprint.pprint(env['PYTHONPATH']) + env['PYTHONPATH'] = sys.path + # pprint.pprint(env) + # pprint.pprint(env['PYTHONPATH']) process = Popen(recording.get_args(command), stdin=ifile, stderr=PIPE, stdout=PIPE, env=env) output, errors = process.communicate() with io.open(recording.output_file, 'rb') as ifile: From 0c34f3d08d7218727f0eeb2907067935ddf878d2 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 15:23:02 -0800 Subject: [PATCH 09/14] modify python path --- tests/searchcommands/test_searchcommands_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/searchcommands/test_searchcommands_app.py b/tests/searchcommands/test_searchcommands_app.py index b2f0f6ed0..00300ad6e 100755 --- a/tests/searchcommands/test_searchcommands_app.py +++ b/tests/searchcommands/test_searchcommands_app.py @@ -417,7 +417,7 @@ def _run_command(self, name, action=None, phase=None, protocol=2): ofile.write(b) with io.open(uncompressed_file, 'rb') as ifile: env = os.environ.copy() - env['PYTHONPATH'] = sys.path + env['PYTHONPATH'] = ":".join(sys.path) # pprint.pprint(env) # pprint.pprint(env['PYTHONPATH']) process = Popen(recording.get_args(command), stdin=ifile, stderr=PIPE, stdout=PIPE, env=env) From 72abd043809eed192883f703be7ea0665670931c Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Mon, 28 Jan 2019 15:39:42 -0800 Subject: [PATCH 10/14] apply changes --- examples/searchcommands_app/README.md | 8 ++++---- examples/searchcommands_app/package/bin/countmatches.py | 4 +++- examples/searchcommands_app/package/bin/filter.py | 6 +++--- examples/searchcommands_app/package/bin/generatehello.py | 8 +++++--- examples/searchcommands_app/package/bin/generatetext.py | 6 ++++-- .../searchcommands_app/package/bin/pypygeneratetext.py | 7 ++++--- examples/searchcommands_app/package/bin/simulate.py | 8 +++++--- examples/searchcommands_app/package/bin/sum.py | 4 +++- examples/searchcommands_app/setup.py | 1 - setup.py | 2 +- tests/searchcommands/test_searchcommands_app.py | 2 -- 11 files changed, 32 insertions(+), 24 deletions(-) diff --git a/examples/searchcommands_app/README.md b/examples/searchcommands_app/README.md index 763022f97..61bb4673a 100644 --- a/examples/searchcommands_app/README.md +++ b/examples/searchcommands_app/README.md @@ -15,14 +15,14 @@ The app is tested on Splunk 5 and 6. Here is its manifest: ``` ├── bin -│ ├── splunklib -│ │ └── searchcommands ....... splunklib.searchcommands module │   ├── countmatches.py .......... CountMatchesCommand implementation │ ├── generatetext.py .......... GenerateTextCommand implementation │ ├── pypygeneratetext.py ...... Executes generatetext.py with PyPy │ ├── simulate.py .............. SimulateCommand implementation -│ ├── sum.py ................... SumCommand implementation -│   └── +│ └── sum.py ................... SumCommand implementation +├── lib +| └── splunklib +│ └── searchcommands ....... splunklib.searchcommands module ├── default │ ├── data │ │   └── ui diff --git a/examples/searchcommands_app/package/bin/countmatches.py b/examples/searchcommands_app/package/bin/countmatches.py index 67f20b4d5..c8049f665 100755 --- a/examples/searchcommands_app/package/bin/countmatches.py +++ b/examples/searchcommands_app/package/bin/countmatches.py @@ -17,8 +17,10 @@ from __future__ import absolute_import, division, print_function, unicode_literals import app -import sys +import os,sys +splunkhome = os.environ['SPLUNK_HOME'] +sys.path.append(os.path.join(splunkhome, 'etc', 'apps', 'searchcommands_app', 'lib')) from splunklib.searchcommands import dispatch, StreamingCommand, Configuration, Option, validators from splunklib import six diff --git a/examples/searchcommands_app/package/bin/filter.py b/examples/searchcommands_app/package/bin/filter.py index 36c719eff..f85615c17 100755 --- a/examples/searchcommands_app/package/bin/filter.py +++ b/examples/searchcommands_app/package/bin/filter.py @@ -17,13 +17,13 @@ from __future__ import absolute_import, division, print_function, unicode_literals import app +import os,sys +splunkhome = os.environ['SPLUNK_HOME'] +sys.path.append(os.path.join(splunkhome, 'etc', 'apps', 'searchcommands_app', 'lib')) from splunklib.searchcommands import dispatch, EventingCommand, Configuration, Option from splunklib.searchcommands.validators import Code -import sys - - @Configuration() class FilterCommand(EventingCommand): """ Filters, augments, and updates records on the events stream. diff --git a/examples/searchcommands_app/package/bin/generatehello.py b/examples/searchcommands_app/package/bin/generatehello.py index c8bcc506c..b61e8d8d6 100755 --- a/examples/searchcommands_app/package/bin/generatehello.py +++ b/examples/searchcommands_app/package/bin/generatehello.py @@ -17,11 +17,13 @@ from __future__ import absolute_import, division, print_function, unicode_literals import app +import os,sys +import time +splunkhome = os.environ['SPLUNK_HOME'] +sys.path.append(os.path.join(splunkhome, 'etc', 'apps', 'searchcommands_app', 'lib')) from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators -import sys -import time -from six.moves import range +from splunklib.six.moves import range @Configuration() diff --git a/examples/searchcommands_app/package/bin/generatetext.py b/examples/searchcommands_app/package/bin/generatetext.py index 34411fc49..f999f11b1 100755 --- a/examples/searchcommands_app/package/bin/generatetext.py +++ b/examples/searchcommands_app/package/bin/generatetext.py @@ -17,10 +17,12 @@ from __future__ import absolute_import, division, print_function, unicode_literals import app +import os,sys +import time +splunkhome = os.environ['SPLUNK_HOME'] +sys.path.append(os.path.join(splunkhome, 'etc', 'apps', 'searchcommands_app', 'lib')) from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators -import sys -import time from splunklib import six from splunklib.six.moves import range diff --git a/examples/searchcommands_app/package/bin/pypygeneratetext.py b/examples/searchcommands_app/package/bin/pypygeneratetext.py index aec19e2f9..adf2c3b35 100755 --- a/examples/searchcommands_app/package/bin/pypygeneratetext.py +++ b/examples/searchcommands_app/package/bin/pypygeneratetext.py @@ -63,11 +63,12 @@ from __future__ import absolute_import, division, print_function, unicode_literals import app - -from splunklib.searchcommands import app_root, execute +import sys from os import environ, path -import sys +splunkhome = environ['SPLUNK_HOME'] +sys.path.append(path.join(splunkhome, 'etc', 'apps', 'searchcommands_app', 'lib')) +from splunklib.searchcommands import app_root, execute pypy_argv = ['pypy', path.join(app_root, 'bin', 'generatetext.py')] + sys.argv[1:] pypy_environ = dict(environ) diff --git a/examples/searchcommands_app/package/bin/simulate.py b/examples/searchcommands_app/package/bin/simulate.py index fb616938b..31d68423f 100755 --- a/examples/searchcommands_app/package/bin/simulate.py +++ b/examples/searchcommands_app/package/bin/simulate.py @@ -17,13 +17,15 @@ from __future__ import absolute_import, division, print_function, unicode_literals import app - -from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators import random import csv -import sys +import os,sys import time +splunkhome = os.environ['SPLUNK_HOME'] +sys.path.append(os.path.join(splunkhome, 'etc', 'apps', 'searchcommands_app', 'lib')) +from splunklib.searchcommands import dispatch, GeneratingCommand, Configuration, Option, validators + @Configuration() class SimulateCommand(GeneratingCommand): diff --git a/examples/searchcommands_app/package/bin/sum.py b/examples/searchcommands_app/package/bin/sum.py index 425f9dd45..a714699db 100755 --- a/examples/searchcommands_app/package/bin/sum.py +++ b/examples/searchcommands_app/package/bin/sum.py @@ -17,9 +17,11 @@ from __future__ import absolute_import, division, print_function, unicode_literals import app +import os,sys +splunkhome = os.environ['SPLUNK_HOME'] +sys.path.append(os.path.join(splunkhome, 'etc', 'apps', 'searchcommands_app', 'lib')) from splunklib.searchcommands import dispatch, ReportingCommand, Configuration, Option, validators -import sys @Configuration(requires_preop=True) diff --git a/examples/searchcommands_app/setup.py b/examples/searchcommands_app/setup.py index 052d64dad..7fb650d6a 100755 --- a/examples/searchcommands_app/setup.py +++ b/examples/searchcommands_app/setup.py @@ -459,7 +459,6 @@ def run(self): package_dir={ 'lib': os.path.join('package', 'lib'), 'lib.splunklib': os.path.join('..', '..', 'splunklib'), - 'bin.packages.splunklib': os.path.join('..', '..', 'splunklib'), 'lib.splunklib.searchcommands': os.path.join('..', '..', 'splunklib', 'searchcommands') }, package_data={ diff --git a/setup.py b/setup.py index e527ae01a..120cb0333 100755 --- a/setup.py +++ b/setup.py @@ -52,7 +52,7 @@ def _makeResult(self): self.stream, self.descriptions, self.verbosity) original_cwd = os.path.abspath(os.getcwd()) - os.chdir('tests/searchcommands') + os.chdir('tests') suite = unittest.defaultTestLoader.discover('.') runner = TrackingTextTestRunner(verbosity=2) runner.run(suite) diff --git a/tests/searchcommands/test_searchcommands_app.py b/tests/searchcommands/test_searchcommands_app.py index 00300ad6e..5e0c48e8d 100755 --- a/tests/searchcommands/test_searchcommands_app.py +++ b/tests/searchcommands/test_searchcommands_app.py @@ -418,8 +418,6 @@ def _run_command(self, name, action=None, phase=None, protocol=2): with io.open(uncompressed_file, 'rb') as ifile: env = os.environ.copy() env['PYTHONPATH'] = ":".join(sys.path) - # pprint.pprint(env) - # pprint.pprint(env['PYTHONPATH']) process = Popen(recording.get_args(command), stdin=ifile, stderr=PIPE, stdout=PIPE, env=env) output, errors = process.communicate() with io.open(recording.output_file, 'rb') as ifile: From 5af1737e5392bb2a7a95b63a88862cb6a0830c5c Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Tue, 29 Jan 2019 11:18:15 -0800 Subject: [PATCH 11/14] deleted unnecessary files --- .vscode/launch.json | 67 ------------------- .vscode/settings.json | 13 ---- .../searchcommands_app/package/lib/splunklib | 1 - 3 files changed, 81 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json delete mode 120000 examples/searchcommands_app/package/lib/splunklib diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 32418632e..000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Python: Current File (Integrated Terminal)", - "type": "python", - "request": "launch", - "program": "${workspaceFolder}/setup.py", - "args": ["test"], - "console": "integratedTerminal" - }, - { - "name": "Python: Attach", - "type": "python", - "request": "attach", - "port": 5678, - "host": "localhost" - }, - { - "name": "Python: Module", - "type": "python", - "request": "launch", - "module": "enter-your-module-name-here", - "console": "integratedTerminal" - }, - { - "name": "Python: Django", - "type": "python", - "request": "launch", - "program": "${workspaceFolder}/manage.py", - "console": "integratedTerminal", - "args": [ - "runserver", - "--noreload", - "--nothreading" - ], - "django": true - }, - { - "name": "Python: Flask", - "type": "python", - "request": "launch", - "module": "flask", - "env": { - "FLASK_APP": "app.py" - }, - "args": [ - "run", - "--no-debugger", - "--no-reload" - ], - "jinja": true - }, - { - "name": "Python: Current File (External Terminal)", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "externalTerminal" - }, - - - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9846e806d..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "python.pythonPath": "/usr/bin/python", - "python.unitTest.unittestArgs": [ - "-v", - "-s", - "./tests", - "-p", - "test_*.py" - ], - "python.unitTest.pyTestEnabled": false, - "python.unitTest.nosetestsEnabled": false, - "python.unitTest.unittestEnabled": true -} \ No newline at end of file diff --git a/examples/searchcommands_app/package/lib/splunklib b/examples/searchcommands_app/package/lib/splunklib deleted file mode 120000 index fdf5ebd7f..000000000 --- a/examples/searchcommands_app/package/lib/splunklib +++ /dev/null @@ -1 +0,0 @@ -/Users/xcheng/repo/github/splunk-sdk-python/splunklib \ No newline at end of file From fc09d7fa8fb1b21970bd1bab700f252f2fe25fa7 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Tue, 29 Jan 2019 11:18:41 -0800 Subject: [PATCH 12/14] gitignore vscode setting --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 16ed57366..d04e26353 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ .coverage .coverage.* .python-version +.vscode __stdout__ docs/_build build/ From 2345fa5221a749460e649e0c8205a8bed04918ed Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Tue, 29 Jan 2019 11:20:15 -0800 Subject: [PATCH 13/14] revert unwanted changes --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 120cb0333..88ae73b5b 100755 --- a/setup.py +++ b/setup.py @@ -68,7 +68,7 @@ def run_test_suite_with_junit_output(): import unittest import xmlrunner original_cwd = os.path.abspath(os.getcwd()) - os.chdir('tests/searchcommands') + os.chdir('tests') suite = unittest.defaultTestLoader.discover('.') xmlrunner.XMLTestRunner(output='../test-reports').run(suite) os.chdir(original_cwd) From 43c0fb09f98ef75a9d85e87ceeedca9a7621bb40 Mon Sep 17 00:00:00 2001 From: Eric Cheng Date: Tue, 29 Jan 2019 11:21:06 -0800 Subject: [PATCH 14/14] removed unused module import --- tests/searchcommands/test_searchcommands_app.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/searchcommands/test_searchcommands_app.py b/tests/searchcommands/test_searchcommands_app.py index 5e0c48e8d..2c4d09562 100755 --- a/tests/searchcommands/test_searchcommands_app.py +++ b/tests/searchcommands/test_searchcommands_app.py @@ -44,7 +44,6 @@ import io import os import sys -import pprint try: from tests.searchcommands import project_root