[GitHub] anirudhacharya commented on a change in pull request #13271: [WIP] [Example] adding tests for examples

2018-11-15 Thread GitBox
anirudhacharya commented on a change in pull request #13271: [WIP] [Example] 
adding tests for examples
URL: https://github.com/apache/incubator-mxnet/pull/13271#discussion_r233747738
 
 

 ##
 File path: tests/examples/test_examples.py
 ##
 @@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#pylint: disable=no-member, too-many-locals, too-many-branches, no-self-use, 
broad-except, lost-exception, too-many-nested-blocks, too-few-public-methods, 
invalid-name
+"""
+This file tests and ensures that the examples run correctly.
+
+"""
+import os
+import sys
+import subprocess
+
+def _run_command(command):
+"""Runs the script using command
+
+Parameters
+--
+command : list of str
+the command that needs to be run in form of list
+Example : ['ls', '-l']
+
+Returns
+---
+True if there are no warnings or errors.
+"""
+errors = []
+try:
+   check_call(command)
 
 Review comment:
   This code is not being used or run anywhere. Not getting tested either. I 
would prefer if these changes and PR - 
https://github.com/apache/incubator-mxnet/pull/13270 were merged into a single 
PR. 
   
   The above comment is just one instance of an error that might go unnoticed 
if we have separate PRs.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] anirudhacharya commented on a change in pull request #13271: [WIP] [Example] adding tests for examples

2018-11-15 Thread GitBox
anirudhacharya commented on a change in pull request #13271: [WIP] [Example] 
adding tests for examples
URL: https://github.com/apache/incubator-mxnet/pull/13271#discussion_r233751039
 
 

 ##
 File path: tests/examples/test_examples.py
 ##
 @@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#pylint: disable=no-member, too-many-locals, too-many-branches, no-self-use, 
broad-except, lost-exception, too-many-nested-blocks, too-few-public-methods, 
invalid-name
+"""
+This file tests and ensures that the examples run correctly.
+
+"""
+import os
+import sys
+import subprocess
+
+def _run_command(command):
+"""Runs the script using command
+
+Parameters
+--
+command : list of str
+the command that needs to be run in form of list
+Example : ['ls', '-l']
+
+Returns
+---
+True if there are no warnings or errors.
+"""
+errors = []
+try:
+   check_call(command)
+except Exception as err:
+err_msg = str(err)
+errors.append(err_msg)
+finally:
+if len(errors) > 0:
+logging.error('\n'.join(errors))
 
 Review comment:
   why is this happening in the `finally` block. Why not just log it in the 
`except` block and return false. And remove the `finally` block.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] anirudhacharya commented on a change in pull request #13271: [WIP] [Example] adding tests for examples

2018-11-15 Thread GitBox
anirudhacharya commented on a change in pull request #13271: [WIP] [Example] 
adding tests for examples
URL: https://github.com/apache/incubator-mxnet/pull/13271#discussion_r233748412
 
 

 ##
 File path: tests/examples/test_examples.py
 ##
 @@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#pylint: disable=no-member, too-many-locals, too-many-branches, no-self-use, 
broad-except, lost-exception, too-many-nested-blocks, too-few-public-methods, 
invalid-name
+"""
+This file tests and ensures that the examples run correctly.
+
+"""
+import os
+import sys
+import subprocess
+
+def _run_command(command):
+"""Runs the script using command
+
+Parameters
+--
+command : list of str
+the command that needs to be run in form of list
+Example : ['ls', '-l']
+
+Returns
+---
+True if there are no warnings or errors.
+"""
+errors = []
+try:
+   check_call(command)
+except Exception as err:
+err_msg = str(err)
+errors.append(err_msg)
 
 Review comment:
   you could combine these two statements - `errors.append(str(err_msg))`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] anirudhacharya commented on a change in pull request #13271: [WIP] [Example] adding tests for examples

2018-11-15 Thread GitBox
anirudhacharya commented on a change in pull request #13271: [WIP] [Example] 
adding tests for examples
URL: https://github.com/apache/incubator-mxnet/pull/13271#discussion_r233745860
 
 

 ##
 File path: tests/examples/test_examples.py
 ##
 @@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#pylint: disable=no-member, too-many-locals, too-many-branches, no-self-use, 
broad-except, lost-exception, too-many-nested-blocks, too-few-public-methods, 
invalid-name
+"""
+This file tests and ensures that the examples run correctly.
+
+"""
+import os
+import sys
+import subprocess
+
+def _run_command(command):
+"""Runs the script using command
+
+Parameters
+--
+command : list of str
+the command that needs to be run in form of list
+Example : ['ls', '-l']
+
+Returns
+---
+True if there are no warnings or errors.
+"""
+errors = []
+try:
+   check_call(command)
 
 Review comment:
   check_call -> subprocess.check_call


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] anirudhacharya commented on a change in pull request #13271: [WIP] [Example] adding tests for examples

2018-11-15 Thread GitBox
anirudhacharya commented on a change in pull request #13271: [WIP] [Example] 
adding tests for examples
URL: https://github.com/apache/incubator-mxnet/pull/13271#discussion_r233753329
 
 

 ##
 File path: tests/examples/test_examples.py
 ##
 @@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#pylint: disable=no-member, too-many-locals, too-many-branches, no-self-use, 
broad-except, lost-exception, too-many-nested-blocks, too-few-public-methods, 
invalid-name
+"""
+This file tests and ensures that the examples run correctly.
+
+"""
+import os
+import sys
+import subprocess
+
+def _run_command(command):
+"""Runs the script using command
+
+Parameters
+--
+command : list of str
+the command that needs to be run in form of list
+Example : ['ls', '-l']
+
+Returns
+---
+True if there are no warnings or errors.
+"""
+errors = []
+try:
+   check_call(command)
+except Exception as err:
 
 Review comment:
   what sort of exception are we expecting here? I think a 
`CalledProcess(Exception/Error)`. 
   
   Better to know what exception we are catching than using a generic 
`Exception` to catch all errors.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] anirudhacharya commented on a change in pull request #13271: [WIP] [Example] adding tests for examples

2018-11-15 Thread GitBox
anirudhacharya commented on a change in pull request #13271: [WIP] [Example] 
adding tests for examples
URL: https://github.com/apache/incubator-mxnet/pull/13271#discussion_r233750593
 
 

 ##
 File path: tests/examples/test_examples.py
 ##
 @@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#pylint: disable=no-member, too-many-locals, too-many-branches, no-self-use, 
broad-except, lost-exception, too-many-nested-blocks, too-few-public-methods, 
invalid-name
+"""
+This file tests and ensures that the examples run correctly.
+
+"""
+import os
+import sys
+import subprocess
+
+def _run_command(command):
+"""Runs the script using command
+
+Parameters
+--
+command : list of str
+the command that needs to be run in form of list
+Example : ['ls', '-l']
+
+Returns
+---
+True if there are no warnings or errors.
+"""
+errors = []
+try:
+   check_call(command)
+except Exception as err:
+err_msg = str(err)
+errors.append(err_msg)
+finally:
+if len(errors) > 0:
 
 Review comment:
   a more pythonic suggestion ``if errors:``


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] anirudhacharya commented on a change in pull request #13271: [WIP] [Example] adding tests for examples

2018-11-15 Thread GitBox
anirudhacharya commented on a change in pull request #13271: [WIP] [Example] 
adding tests for examples
URL: https://github.com/apache/incubator-mxnet/pull/13271#discussion_r233758368
 
 

 ##
 File path: tests/examples/test_examples.py
 ##
 @@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#pylint: disable=no-member, too-many-locals, too-many-branches, no-self-use, 
broad-except, lost-exception, too-many-nested-blocks, too-few-public-methods, 
invalid-name
+"""
+This file tests and ensures that the examples run correctly.
 
 Review comment:
   it does not ensure the correctness of the example. it only performs a sanity 
check of the example. can you please change this.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services