This repository was archived by the owner on Aug 25, 2024. It is now read-only.
File tree 5 files changed +38
-10
lines changed
5 files changed +38
-10
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
### Added
9
9
- Async helper concurrently nocancel optional keyword argument which, if set is
10
10
a set of tasks not to cancel when the concurrently execution loop completes.
11
+ - FileSourceTest has a ` test_label ` method which checks that a FileSource knows
12
+ how to properly load and save repos under a given label.
11
13
### Changed
12
14
- feature/codesec became it's own branch, binsec
13
15
- BaseOrchestratorContext ` run_operations ` strict is default to true. With
Original file line number Diff line number Diff line change @@ -118,3 +118,19 @@ async def test_update(self):
118
118
testdir , str (random .random ) + "." + extension
119
119
)
120
120
await super ().test_update ()
121
+
122
+ async def test_label (self ):
123
+ with tempfile .TemporaryDirectory () as testdir :
124
+ self .testfile = os .path .join (testdir , str (random .random ))
125
+ unlabeled = await self .setUpSource ()
126
+ labeled = await self .setUpSource ()
127
+ labeled .config = labeled .config ._replace (label = "somelabel" )
128
+ async with unlabeled :
129
+ async with unlabeled () as uctx :
130
+ await uctx .update (
131
+ Repo ("0" , data = {"features" : {"life" : 42 }})
132
+ )
133
+ async with labeled :
134
+ async with labeled () as lctx :
135
+ repo = await lctx .repo ("0" )
136
+ self .assertNotIn ("life" , repo .features ())
Original file line number Diff line number Diff line change 1
- from dffml .util .testing .source import SourceTest
1
+ import unittest
2
+
3
+ from dffml .util .testing .source import FileSourceTest
2
4
from dffml .util .asynctestcase import AsyncTestCase
3
5
4
6
from .custom_sqlite import CustomSQLiteSourceConfig , CustomSQLiteSource
5
7
6
8
7
- class TestJSONSource (SourceTest , AsyncTestCase ):
8
- async def setUpFile (self , fileobj ):
9
- return
10
- fileobj .write (b"{}" )
11
- fileobj .seek (0 )
12
-
13
- async def setUpSource (self , fileobj ):
9
+ class TestJSONSource (FileSourceTest , AsyncTestCase ):
10
+ async def setUpSource (self ):
14
11
return CustomSQLiteSource (
15
- CustomSQLiteSourceConfig (filename = fileobj . name )
12
+ CustomSQLiteSourceConfig (filename = self . testfile )
16
13
)
14
+
15
+ @unittest .skip ("Labels not implemented" )
16
+ async def test_label (self ):
17
+ """
18
+ Labels not implemented
19
+ """
Original file line number Diff line number Diff line change 1
1
# SPDX-License-Identifier: MIT
2
2
# Copyright (c) 2019 Intel Corporation
3
+ import unittest
4
+
3
5
from dffml .source .file import FileSourceConfig
4
6
from dffml .source .csv import CSVSource
5
7
from dffml .util .testing .source import FileSourceTest
9
11
class TestCSVSource (FileSourceTest , AsyncTestCase ):
10
12
async def setUpSource (self ):
11
13
return CSVSource (FileSourceConfig (filename = self .testfile ))
14
+
15
+ @unittest .skip ("Labels not implemented yet for CSV files" )
16
+ async def test_label (self ):
17
+ """
18
+ Labels not implemented yet for CSV files
19
+ """
Original file line number Diff line number Diff line change 7
7
8
8
9
9
class TestJSONSource (FileSourceTest , AsyncTestCase ):
10
-
11
10
async def setUpSource (self ):
12
11
return JSONSource (FileSourceConfig (filename = self .testfile ))
You can’t perform that action at this time.
0 commit comments