Coverage for src/km3pipe/tests/test_cmd.py: 100%

27 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-19 03:14 +0000

1# Filename: test_cmd.py 

2# pylint: disable=C0111,E1003,R0904,C0103,R0201,C0102 

3 

4from km3pipe.testing import TestCase, patch 

5from km3pipe.cmd import update_km3pipe, KM3PIPE_GIT 

6 

7__author__ = "Tamas Gal" 

8__copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration." 

9__credits__ = [] 

10__license__ = "MIT" 

11__maintainer__ = "Tamas Gal" 

12__email__ = "tgal@km3net.de" 

13__status__ = "Development" 

14 

15 

16class TestUpdateKm3pipe(TestCase): 

17 @patch("km3pipe.cmd.os") 

18 def test_update_without_args_updates_master(self, mock_os): 

19 update_km3pipe() 

20 expected = "pip install -U git+{0}@master".format(KM3PIPE_GIT) 

21 mock_os.system.assert_called_with(expected) 

22 update_km3pipe("") 

23 expected = "pip install -U git+{0}@master".format(KM3PIPE_GIT) 

24 mock_os.system.assert_called_with(expected) 

25 update_km3pipe(None) 

26 expected = "pip install -U git+{0}@master".format(KM3PIPE_GIT) 

27 mock_os.system.assert_called_with(expected) 

28 

29 @patch("km3pipe.cmd.os") 

30 def test_update_branch(self, mock_os): 

31 branch = "foo" 

32 update_km3pipe(branch) 

33 expected = "pip install -U git+{0}@{1}".format(KM3PIPE_GIT, branch) 

34 mock_os.system.assert_called_with(expected)