|
17 | 17 | # along with this program; if not, write to the Free Software Foundation, |
18 | 18 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
19 | 19 | # |
20 | | - |
| 20 | +import os |
21 | 21 | from unittest.mock import patch |
22 | 22 |
|
23 | 23 | import pyfakefs.fake_filesystem_unittest as pyfakefs |
|
26 | 26 | from pysonar_scanner.configuration.properties import ( |
27 | 27 | SONAR_PROJECT_KEY, |
28 | 28 | SONAR_PROJECT_NAME, |
| 29 | + SONAR_PROJECT_BASE_DIR, |
29 | 30 | SONAR_SCANNER_APP, |
30 | 31 | SONAR_SCANNER_APP_VERSION, |
31 | 32 | SONAR_SCANNER_BOOTSTRAP_START_TIME, |
|
49 | 50 | SONAR_SCANNER_ARCH, |
50 | 51 | SONAR_SCANNER_OS, |
51 | 52 | ) |
52 | | -from pysonar_scanner.configuration.configuration_loader import ConfigurationLoader, SONAR_PROJECT_BASE_DIR |
| 53 | +from pysonar_scanner.configuration.configuration_loader import ConfigurationLoader |
53 | 54 | from pysonar_scanner.exceptions import MissingKeyException |
54 | 55 | from pysonar_scanner.utils import Arch, Os |
55 | 56 |
|
@@ -98,11 +99,15 @@ def test_no_defaults_in_configuration_loaders( |
98 | 99 | @patch("pysonar_scanner.configuration.configuration_loader.get_static_default_properties", return_value={}) |
99 | 100 | @patch("sys.argv", ["myscript.py"]) |
100 | 101 | def test_dynamic_defaults_are_loaded(self, get_static_default_properties_mock, mock_get_os, mock_get_arch): |
| 102 | + custom_dir = "/my_analysis_directory" |
| 103 | + self.fs.create_dir(custom_dir) |
| 104 | + os.chdir(custom_dir) |
101 | 105 | config = ConfigurationLoader.load() |
| 106 | + |
102 | 107 | self.assertDictEqual( |
103 | 108 | config, |
104 | 109 | { |
105 | | - SONAR_PROJECT_BASE_DIR: "/", |
| 110 | + SONAR_PROJECT_BASE_DIR: "/my_analysis_directory", |
106 | 111 | SONAR_SCANNER_OS: Os.LINUX.value, |
107 | 112 | SONAR_SCANNER_ARCH: Arch.X64.value, |
108 | 113 | }, |
|
0 commit comments