File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
2
import unittest
3
+ from unittest .mock import patch
3
4
4
5
import pystac
5
6
from tests .utils import TestCases
6
7
7
8
8
9
class VersionTest (unittest .TestCase ):
9
10
def setUp (self ) -> None :
10
- self ._prev_env_version = os .environ .get ("PYSTAC_STAC_VERSION_OVERRIDE" )
11
- self ._prev_version = pystac .get_stac_version ()
12
-
13
- def tearDown (self ) -> None :
14
- if self ._prev_env_version is None :
15
- os .environ .pop ("PYSTAC_STAC_VERSION_OVERRIDE" , None )
16
- else :
17
- os .environ ["PYSTAC_STAC_VERSION_OVERRIDE" ] = self ._prev_env_version
18
- pystac .set_stac_version (None )
11
+ pystac .version .STACVersion ._override_version = None
19
12
20
13
def test_override_stac_version_with_environ (self ) -> None :
21
-
22
14
override_version = "1.0.0-gamma.2"
23
- os .environ [ "PYSTAC_STAC_VERSION_OVERRIDE" ] = override_version
24
- cat = TestCases .test_case_1 ()
25
- d = cat .to_dict ()
15
+ with patch . dict ( os .environ , { "PYSTAC_STAC_VERSION_OVERRIDE" : override_version }):
16
+ cat = TestCases .test_case_1 ()
17
+ d = cat .to_dict ()
26
18
self .assertEqual (d ["stac_version" ], override_version )
27
19
28
20
def test_override_stac_version_with_call (self ) -> None :
You can’t perform that action at this time.
0 commit comments