This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01fafeb
commit c1b2362
Showing
14 changed files
with
76 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from loads.results.adapter import LoadsTestResult # NOQA | ||
from loads.results._unittest import UnitTestTestResult # NOQA | ||
from loads.results.zmqrelay import ZMQTestResult # NOQA | ||
from loads.results.base import TestResult, LazyTestResult # NOQA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import unittest | ||
|
||
|
||
class UnitTestTestResult(unittest.TestResult): | ||
"""Used to make Loads test cases compatible with unittest | ||
This class will ignore the extra options used by Loads, so | ||
tests written for loads can also be run in Nose or Unittest(2) | ||
""" | ||
def startTest(self, test, *args, **kw): | ||
unittest.TestResult.startTest(self, test) | ||
|
||
def stopTest(self, test, *args, **kw): | ||
unittest.TestResult.stopTest(self, test) | ||
|
||
def addError(self, test, exc_info, *args, **kw): | ||
unittest.TestResult.addError(self, test, exc_info) | ||
|
||
def addFailure(self, test, exc_info, *args, **kw): | ||
unittest.TestResult.addFailure(self, test, exc_info) | ||
|
||
def addSuccess(self, test, *args, **kw): | ||
unittest.TestResult.addSuccess(self, test) | ||
|
||
def incr_counter(self, test, *args, **kw): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import functools | ||
|
||
|
||
class LoadsTestResult(object): | ||
"""Used to make unitest calls compatible with Loads. | ||
This class will add to the API calls the loads_status option Loads uses. | ||
""" | ||
def __init__(self, loads_status, result): | ||
self.result = result | ||
self.loads_status = loads_status | ||
|
||
def __getattribute__(self, name): | ||
klass = super(LoadsTestResult, self) | ||
result = klass.__getattribute__('result') | ||
attr = getattr(result, name) | ||
if name in ('startTest', 'stopTest', 'addSuccess', 'addException', | ||
'addError', 'addFailure', 'incr_counter'): | ||
status = klass.__getattribute__('loads_status') | ||
return functools.partial(attr, loads_status=status) | ||
return attr |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters