areusch commented on a change in pull request #7289: URL: https://github.com/apache/tvm/pull/7289#discussion_r568071857
########## 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: I guess then though, you're doing processing to construct the test stimulus, which you could screw up. plus, each line here could create multiple problem strings or contribute to composite problem strings such as the final one. ---------------------------------------------------------------- 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]
