mdw-octoml commented on a change in pull request #7289:
URL: https://github.com/apache/tvm/pull/7289#discussion_r568062806



##########
File path: tests/python/unittest/test_gen_requirements.py
##########
@@ -0,0 +1,220 @@
+#!/usr/bin/env python3
+# 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.
+
+"""Tests for gen_requirements, found in python/."""
+
+import collections
+import contextlib
+import os
+import sys
+
+import tvm
+
+import pytest
+
+# Insert the parent dir to python/tvm into the import path, so that 
gen_requirements may be
+# imported.
+sys.path.insert(0, os.path.dirname(tvm.__file__))
+try:
+    import gen_requirements
+finally:
+    sys.path.pop(0)
+
+
[email protected]
+def patch(obj, **kw):
+    old = {}
+    for prop_name, new in kw.items():
+        old[prop_name] = getattr(obj, prop_name)
+        setattr(obj, prop_name, new)
+    yield
+    for prop_name, value in old.items():
+        setattr(obj, prop_name, value)
+
+
+PROBLEM_REQUIREMENTS = [

Review comment:
       Nit: I think this test would be easier to maintain if the expected 
problem string were part of this list, rather than hardcoded in the test case 
in the same order below. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to