-
Notifications
You must be signed in to change notification settings - Fork 14
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
Showing
4 changed files
with
40 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from malcolm.core.loggable import Loggable | ||
|
||
class Part(Loggable): | ||
|
||
def __init__(self, name, process, block): | ||
self.set_logger_name("Part") | ||
self.process = process | ||
self.block = block | ||
self.name = name | ||
self.set_logger_name("%s.%s", block, name) |
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,21 @@ | ||
import os | ||
import sys | ||
sys.path.append(os.path.join(os.path.dirname(__file__), "..")) | ||
import setup_malcolm_paths | ||
|
||
import unittest | ||
from mock import Mock | ||
|
||
from malcolm.core.part import Part | ||
|
||
class TestPart(unittest.TestCase): | ||
def test_init(self): | ||
process = Mock() | ||
block = Mock() | ||
p = Part("part", process, block) | ||
self.assertIs(process, p.process) | ||
self.assertIs(block, p.block) | ||
self.assertEquals("part", p.name) | ||
|
||
if __name__ == "__main__": | ||
unittest.main(verbosity=2) |