Created
April 17, 2015 16:48
-
-
Save 23jodys/d2c88506d7cf5e1b4659 to your computer and use it in GitHub Desktop.
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
import os | |
import shutil | |
import tempfile | |
import textwrap | |
import unittest | |
class TestFileReader(unittest.TestCase): | |
def setUp(self): | |
self.tempdir = tempfile.mkdtemp() | |
test_data = """\ | |
192.168.0.1 testname | |
192.168.1.10 test2 | |
""" | |
self.filename = os.path.join(self.tempdir, "hosts") | |
with open(self.filename, "w") as file_to_write: | |
file_to_write.writelines(textwrap.dedent(test_data)) | |
def tearDown(self): | |
shutil.rmtree(self.tempdir) | |
def test_001(self): | |
print "testing some stuff on '{}' here".format(self.filename) | |
self.assertFalse(True) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment