Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature parity between notebook sample and normal sample #2095

Merged
merged 2 commits into from
Sep 13, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/sample-test/run_sample_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ def run(self):
self._run_pipeline = raw_args['run_pipeline']

try:
with open(os.path.join(CONFIG_DIR, '%s.config.yaml' % self._testname), 'r') as f:
config_file = os.path.join(CONFIG_DIR, '%s.config.yaml' % self._test_name)
gaoning777 marked this conversation as resolved.
Show resolved Hide resolved
with open(config_file, 'r') as f:
raw_args = yaml.safe_load(f)
test_config = yamale.make_data(os.path.join(
CONFIG_DIR, '%s.config.yaml' % self._testname))
test_config = yamale.make_data(config_file)
yamale.validate(config_schema, test_config) # If fails, a ValueError will be raised.
except yaml.YAMLError as yamlerr:
print('No legit yaml config file found, use default args:{}'.format(yamlerr))
Expand Down
8 changes: 5 additions & 3 deletions test/sample-test/sample_test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ def _compile(self):
nb_params = {}

try:
with open(os.path.join(CONFIG_DIR, '%s.config.yaml' % self._test_name), 'r') as f:
config_file = os.path.join(CONFIG_DIR, '%s.config.yaml' % self._test_name)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one should be correct.

with open(config_file, 'r') as f:
raw_args = yaml.safe_load(f)
test_config = yamale.make_data(os.path.join(
CONFIG_DIR, '%s.config.yaml' % self._test_name))
test_config = yamale.make_data(config_file)
yamale.validate(config_schema, test_config) # If fails, a ValueError will be raised.
except yaml.YAMLError as yamlerr:
print('No legit yaml config file found, use default args:{}'.format(yamlerr))
Expand All @@ -115,6 +115,8 @@ def _compile(self):
else:
if 'notebook_params' in raw_args.keys():
nb_params.update(raw_args['notebook_params'])
if 'output' in raw_args['notebook_params'].keys(): # output is a special param that has to be specified dynamically.
nb_params['output'] = self._sample_test_output
if 'run_pipeline' in raw_args.keys():
self._run_pipeline = raw_args['run_pipeline']

Expand Down
3 changes: 0 additions & 3 deletions test/sample-test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License

import google
import os
import re
import subprocess

from google.cloud import storage
from minio import Minio
from junit_xml import TestSuite, TestCase

Expand Down Expand Up @@ -87,4 +85,3 @@ def file_injection(file_in, tmp_file_out, subs):
fout.write(tmp_line)

os.rename(tmp_file_out, file_in)