[Piglit] [Patch v2 3/4] log: Rename get_current and mark_complete
Dylan Baker
baker.dylan.c at gmail.com
Tue Feb 18 05:32:36 PST 2014
This replaces very specific names with more general ones. This should be
more useful if we wanted to subclass log at some point.
Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
framework/core.py | 4 ++--
framework/log.py | 4 ++--
framework/tests/log_tests.py | 46 ++++++++++++++++++++++----------------------
3 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/framework/core.py b/framework/core.py
index f6ae80f..13ed235 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -434,7 +434,7 @@ class Test(object):
``spec/glsl-1.30/preprocessor/compiler/keywords/void.frag``.
'''
- log_current = log.get_current()
+ log_current = log.pre_log()
# Run the test
if env.execute:
try:
@@ -472,7 +472,7 @@ class Test(object):
else:
test_result = 'dry-run'
log.log()
- log.mark_complete(log_current, test_result)
+ log.post_log(log_current, test_result)
class Group(dict):
diff --git a/framework/log.py b/framework/log.py
index 7cdc940..676d122 100644
--- a/framework/log.py
+++ b/framework/log.py
@@ -55,7 +55,7 @@ class Log(object):
str(self.__total).zfill(self.__pad))
@synchronized_self
- def mark_complete(self, value, result):
+ def post_log(self, value, result):
""" Used to mark a test as complete in the log
Arguments:
@@ -89,7 +89,7 @@ class Log(object):
sys.stdout.flush()
@synchronized_self
- def get_current(self):
+ def pre_log(self):
""" Returns a new number to know what processes are running """
x = self.__generator.next()
self.__running.append(x)
diff --git a/framework/tests/log_tests.py b/framework/tests/log_tests.py
index 5effa1f..861bb1a 100644
--- a/framework/tests/log_tests.py
+++ b/framework/tests/log_tests.py
@@ -35,58 +35,58 @@ def test_initialize_log():
assert log
-def test_get_current_return():
+def test_pre_log_return():
""" Test that pre_log returns a number """
log = Log(100)
- ret = log.get_current()
+ ret = log.pre_log()
nt.assert_true(isinstance(ret, (IntType, FloatType, LongType)),
- msg="Log.get_current() didn't return a numeric type!")
+ msg="Log.pre_log() didn't return a numeric type!")
-def test_mark_complete_increment_complete():
- """ Tests that Log.mark_complete() increments self.__complete """
+def test_post_log_increment_complete():
+ """ Tests that Log.post_log() increments self.__complete """
log = Log(100)
- ret = log.get_current()
- log.mark_complete(ret, 'pass')
+ ret = log.pre_log()
+ log.post_log(ret, 'pass')
nt.assert_equal(log._Log__complete, 1,
- msg="Log.mark_complete() did not properly incremented "
+ msg="Log.post_log() did not properly incremented "
"Log.__current")
-def check_mark_complete_increment_summary(stat):
- """ Test that passing a result to mark_complete works correctly """
+def check_post_log_increment_summary(stat):
+ """ Test that passing a result to post_log works correctly """
log = Log(100)
- ret = log.get_current()
- log.mark_complete(ret, stat)
+ ret = log.pre_log()
+ log.post_log(ret, stat)
print log._Log__summary
nt.assert_equal(log._Log__summary[stat], 1,
msg="Log.__summary[{}] was not properly "
"incremented".format(stat))
-def test_mark_complete_increment_summary():
+def test_post_log_increment_summary():
""" Generator that creates tests for self.__summary """
- yieldable = check_mark_complete_increment_summary
+ yieldable = check_post_log_increment_summary
for stat in valid_statuses:
- yieldable.description = ("Test that Log.mark_complete increments "
+ yieldable.description = ("Test that Log.post_log increments "
"self._summary[{}]".format(stat))
yield yieldable, stat
-def test_mark_complete_removes_complete():
- """ Test that Log.mark_complete() removes finished tests from __running """
+def test_post_log_removes_complete():
+ """ Test that Log.post_log() removes finished tests from __running """
log = Log(100)
- ret = log.get_current()
- log.mark_complete(ret, 'pass')
+ ret = log.pre_log()
+ log.post_log(ret, 'pass')
nt.assert_not_in(ret, log._Log__running,
msg="Running tests not removed from running list")
@nt.raises(AssertionError)
-def test_mark_complete_increment_summary_bad():
- """ Only statuses in self.__summary_keys are valid for mark_complete """
+def test_post_log_increment_summary_bad():
+ """ Only statuses in self.__summary_keys are valid for post_log """
log = Log(100)
- ret = log.get_current()
- log.mark_complete(ret, 'fails')
+ ret = log.pre_log()
+ log.post_log(ret, 'fails')
--
1.9.0
More information about the Piglit
mailing list