Coverage for tests/test_mem.py: 53%

15 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-02-01 11:14 +0000

1# This file is part of lsst-resources. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://www.lsst.org). 

6# See the COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# Use of this source code is governed by a 3-clause BSD-style 

10# license that can be found in the LICENSE file. 

11 

12import unittest 

13 

14from lsst.resources import ResourcePath 

15from lsst.resources.tests import GenericTestCase 

16 

17 

18class MemoryTestCase(GenericTestCase, unittest.TestCase): 

19 """Generic tests of the mem URI.""" 

20 

21 scheme = "mem" 

22 netloc = "unknown" 

23 

24 

25class MemoryReadTestCase(unittest.TestCase): 

26 """Simple tests of I/O with mem URI.""" 

27 

28 def setUp(self): 

29 self.root_uri = ResourcePath("mem://x/y.z") 

30 

31 def test_exists(self): 

32 """Always exist.""" 

33 self.assertTrue(self.root_uri.exists()) 

34 

35 def test_local(self): 

36 with self.assertRaises(RuntimeError): 

37 with self.root_uri.as_local(): 

38 pass 

39 

40 

41if __name__ == "__main__": 

42 unittest.main()