Moves tests from contrib/learn/tests to a better place whenever possible.
Change: 136095744
This commit is contained in:
parent
a480dbecf9
commit
8a162085d1
tensorflow/contrib/learn
@ -27,19 +27,7 @@ py_library(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "base_test",
|
name = "base_test",
|
||||||
size = "medium",
|
size = "medium",
|
||||||
srcs = ["python/learn/tests/base_test.py"],
|
srcs = ["python/learn/estimators/base_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
|
||||||
deps = [
|
|
||||||
":learn",
|
|
||||||
"//tensorflow:tensorflow_py",
|
|
||||||
"//tensorflow/python:framework_test_lib",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
py_test(
|
|
||||||
name = "load_csv_test",
|
|
||||||
size = "small",
|
|
||||||
srcs = ["python/learn/tests/load_csv_test.py"],
|
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -51,7 +39,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "data_feeder_test",
|
name = "data_feeder_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/data_feeder_test.py"],
|
srcs = ["python/learn/learn_io/data_feeder_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -274,7 +262,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "estimators_test",
|
name = "estimators_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/estimators_test.py"],
|
srcs = ["python/learn/estimators/estimators_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -286,7 +274,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "metric_spec_test",
|
name = "metric_spec_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/metric_spec_test.py"],
|
srcs = ["python/learn/metric_spec_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -298,7 +286,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "experiment_test",
|
name = "experiment_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/experiment_test.py"],
|
srcs = ["python/learn/experiment_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -310,7 +298,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "graph_actions_test",
|
name = "graph_actions_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/graph_actions_test.py"],
|
srcs = ["python/learn/graph_actions_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -322,7 +310,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "learn_runner_test",
|
name = "learn_runner_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/learn_runner_test.py"],
|
srcs = ["python/learn/learn_runner_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -334,7 +322,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "monitors_test",
|
name = "monitors_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/monitors_test.py"],
|
srcs = ["python/learn/monitors_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -347,7 +335,7 @@ py_test(
|
|||||||
name = "run_config_test",
|
name = "run_config_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = [
|
srcs = [
|
||||||
"python/learn/tests/run_config_test.py",
|
"python/learn/estimators/run_config_test.py",
|
||||||
],
|
],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
@ -522,7 +510,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "grid_search_test",
|
name = "grid_search_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/grid_search_test.py"],
|
srcs = ["python/learn/grid_search_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -534,7 +522,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "io_test",
|
name = "io_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/io_test.py"],
|
srcs = ["python/learn/learn_io/io_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -546,7 +534,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "multioutput_test",
|
name = "multioutput_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/multioutput_test.py"],
|
srcs = ["python/learn/estimators/multioutput_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -558,7 +546,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "nonlinear_test",
|
name = "nonlinear_test",
|
||||||
size = "medium",
|
size = "medium",
|
||||||
srcs = ["python/learn/tests/nonlinear_test.py"],
|
srcs = ["python/learn/estimators/nonlinear_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -570,7 +558,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "regression_test",
|
name = "regression_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/regression_test.py"],
|
srcs = ["python/learn/estimators/regression_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
@ -671,7 +659,7 @@ py_test(
|
|||||||
py_test(
|
py_test(
|
||||||
name = "stability_test",
|
name = "stability_test",
|
||||||
size = "small",
|
size = "small",
|
||||||
srcs = ["python/learn/tests/stability_test.py"],
|
srcs = ["python/learn/estimators/stability_test.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
deps = [
|
deps = [
|
||||||
":learn",
|
":learn",
|
||||||
|
@ -43,3 +43,15 @@ filegroup(
|
|||||||
),
|
),
|
||||||
visibility = ["//tensorflow:__subpackages__"],
|
visibility = ["//tensorflow:__subpackages__"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
py_test(
|
||||||
|
name = "load_csv_test",
|
||||||
|
size = "small",
|
||||||
|
srcs = ["load_csv_test.py"],
|
||||||
|
srcs_version = "PY2AND3",
|
||||||
|
deps = [
|
||||||
|
"//tensorflow:tensorflow_py",
|
||||||
|
"//tensorflow/contrib/learn",
|
||||||
|
"//tensorflow/python:framework_test_lib",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
# pylint: disable=g-bad-file-header
|
|
||||||
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Licensed 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 Runner."""
|
|
||||||
|
|
||||||
from __future__ import absolute_import
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import glob
|
|
||||||
import os
|
|
||||||
|
|
||||||
import tensorflow as tf
|
|
||||||
|
|
||||||
from tensorflow.contrib.learn.python.learn import summary_writer_cache
|
|
||||||
|
|
||||||
|
|
||||||
class SummaryWriterCacheTest(tf.test.TestCase):
|
|
||||||
"""SummaryWriterCache tests."""
|
|
||||||
|
|
||||||
def _test_dir(self, test_name):
|
|
||||||
"""Create an empty dir to use for tests.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
test_name: Name of the test.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
Absolute path to the test directory.
|
|
||||||
"""
|
|
||||||
test_dir = os.path.join(self.get_temp_dir(), test_name)
|
|
||||||
if os.path.isdir(test_dir):
|
|
||||||
for f in glob.glob('%s/*' % test_dir):
|
|
||||||
os.remove(f)
|
|
||||||
else:
|
|
||||||
os.makedirs(test_dir)
|
|
||||||
return test_dir
|
|
||||||
|
|
||||||
def test_cache(self):
|
|
||||||
with tf.Graph().as_default():
|
|
||||||
dir1 = self._test_dir('test_cache_1')
|
|
||||||
dir2 = self._test_dir('test_cache_2')
|
|
||||||
sw1 = summary_writer_cache.SummaryWriterCache.get(dir1)
|
|
||||||
sw2 = summary_writer_cache.SummaryWriterCache.get(dir2)
|
|
||||||
sw3 = summary_writer_cache.SummaryWriterCache.get(dir1)
|
|
||||||
self.assertEqual(sw1, sw3)
|
|
||||||
self.assertFalse(sw1 == sw2)
|
|
||||||
sw1.close()
|
|
||||||
sw2.close()
|
|
||||||
events1 = glob.glob(os.path.join(dir1, 'event*'))
|
|
||||||
self.assertTrue(events1)
|
|
||||||
events2 = glob.glob(os.path.join(dir2, 'event*'))
|
|
||||||
self.assertTrue(events2)
|
|
||||||
events3 = glob.glob(os.path.join('nowriter', 'event*'))
|
|
||||||
self.assertFalse(events3)
|
|
||||||
|
|
||||||
def test_clear(self):
|
|
||||||
with tf.Graph().as_default():
|
|
||||||
dir1 = self._test_dir('test_clear')
|
|
||||||
sw1 = summary_writer_cache.SummaryWriterCache.get(dir1)
|
|
||||||
summary_writer_cache.SummaryWriterCache.clear()
|
|
||||||
sw2 = summary_writer_cache.SummaryWriterCache.get(dir1)
|
|
||||||
self.assertFalse(sw1 == sw2)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
tf.test.main()
|
|
Loading…
Reference in New Issue
Block a user