-
Notifications
You must be signed in to change notification settings - Fork 2
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
6 changed files
with
96 additions
and
5 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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
from .version import __version__ | ||
|
||
from .Argument import Argument | ||
from .DirectoryStorage import DirectoryStorage | ||
from .Stage import Stage | ||
from .Workflow import Workflow | ||
|
||
from .DirectoryStorage import DirectoryStorage | ||
from .GetarStorage import GetarStorage |
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 @@ | ||
# let python use relative imports within this directory |
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,29 @@ | ||
class StorageTestBase: | ||
def test_basic_creation(self): | ||
with self.storage.open('test_file', 'w') as f: | ||
f.write('1') | ||
|
||
with self.storage.open('test_file', 'a') as f: | ||
f.write('2') | ||
|
||
with self.storage.open('test_file', 'r') as f: | ||
self.assertEqual(f.read(), '12') | ||
|
||
def test_binary(self): | ||
with self.storage.open('test_file', 'wb') as f: | ||
f.write(b'1') | ||
|
||
with self.storage.open('test_file', 'ab') as f: | ||
f.write(b'2') | ||
|
||
with self.storage.open('test_file', 'rb') as f: | ||
self.assertEqual(f.read(), b'12') | ||
|
||
def test_file_not_found(self): | ||
with self.assertRaises(FileNotFoundError): | ||
with self.storage.open('new_file', 'r') as f: | ||
pass | ||
|
||
# appending to a file that doesn't exist should just create it | ||
with self.storage.open('new_file', 'a') as f: | ||
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,17 @@ | ||
|
||
import tempfile | ||
import os | ||
import unittest | ||
|
||
import flowws | ||
|
||
from .internal import StorageTestBase | ||
|
||
class TestDirectoryStorage(unittest.TestCase, StorageTestBase): | ||
def setUp(self): | ||
self.tempdir = tempfile.TemporaryDirectory() | ||
dirname = os.path.join(self.tempdir.name, 'test') | ||
self.storage = flowws.DirectoryStorage(dirname) | ||
|
||
def tearDown(self): | ||
self.tempdir.cleanup() |
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,35 @@ | ||
|
||
import tempfile | ||
import os | ||
import unittest | ||
|
||
import flowws | ||
|
||
from .internal import StorageTestBase | ||
|
||
class TestTarStorage(unittest.TestCase, StorageTestBase): | ||
def setUp(self): | ||
self.tempdir = tempfile.TemporaryDirectory() | ||
filename = os.path.join(self.tempdir.name, 'test.tar') | ||
self.storage = flowws.GetarStorage(filename) | ||
|
||
def tearDown(self): | ||
self.tempdir.cleanup() | ||
|
||
class TestZipStorage(unittest.TestCase, StorageTestBase): | ||
def setUp(self): | ||
self.tempdir = tempfile.TemporaryDirectory() | ||
filename = os.path.join(self.tempdir.name, 'test.zip') | ||
self.storage = flowws.GetarStorage(filename) | ||
|
||
def tearDown(self): | ||
self.tempdir.cleanup() | ||
|
||
class TestSqliteStorage(unittest.TestCase, StorageTestBase): | ||
def setUp(self): | ||
self.tempdir = tempfile.TemporaryDirectory() | ||
filename = os.path.join(self.tempdir.name, 'test.sqlite') | ||
self.storage = flowws.GetarStorage(filename) | ||
|
||
def tearDown(self): | ||
self.tempdir.cleanup() |