简体   繁体   中英

test_session deprecation warning when instantiating tf.test.TestCase

I know that test_session is deprecated in tensorflow 1.13 :

Warning: THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use self.session() or self.cached_session() instead.

I created a unit test by only inheriting from tf.test.TestCase (which as I understand it is not deprecated?). I was careful not to explicitly call test_session :

class TestModelFn(tf.test.TestCase):

    def test_nothing(self):
        pass

However, when I run this test I see this:

test_nothing (the_thing.test.objective.cost_based.test_model.TestModelFn) ... ok
test_session (the_thing.test.objective.cost_based.test_model.TestModelFn)
Use cached_session instead. (deprecated) ... skipped 'Not a test.'

Why is this happening? I'm using tensorflow 1.13.1 .

发生这种情况是因为test_session的命名类似于测试方法,因此您的测试运行程序将尝试运行它,从而触发弃用警告和'Not a test'消息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM