Skip to content

Commit cc247df

Browse files
Fix after review
1 parent 644549f commit cc247df

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/test_configuration_loader.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# along with this program; if not, write to the Free Software Foundation,
1818
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1919
#
20-
20+
import os
2121
from unittest.mock import patch
2222

2323
import pyfakefs.fake_filesystem_unittest as pyfakefs
@@ -26,6 +26,7 @@
2626
from pysonar_scanner.configuration.properties import (
2727
SONAR_PROJECT_KEY,
2828
SONAR_PROJECT_NAME,
29+
SONAR_PROJECT_BASE_DIR,
2930
SONAR_SCANNER_APP,
3031
SONAR_SCANNER_APP_VERSION,
3132
SONAR_SCANNER_BOOTSTRAP_START_TIME,
@@ -49,7 +50,7 @@
4950
SONAR_SCANNER_ARCH,
5051
SONAR_SCANNER_OS,
5152
)
52-
from pysonar_scanner.configuration.configuration_loader import ConfigurationLoader, SONAR_PROJECT_BASE_DIR
53+
from pysonar_scanner.configuration.configuration_loader import ConfigurationLoader
5354
from pysonar_scanner.exceptions import MissingKeyException
5455
from pysonar_scanner.utils import Arch, Os
5556

@@ -98,11 +99,15 @@ def test_no_defaults_in_configuration_loaders(
9899
@patch("pysonar_scanner.configuration.configuration_loader.get_static_default_properties", return_value={})
99100
@patch("sys.argv", ["myscript.py"])
100101
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)
101105
config = ConfigurationLoader.load()
106+
102107
self.assertDictEqual(
103108
config,
104109
{
105-
SONAR_PROJECT_BASE_DIR: "/",
110+
SONAR_PROJECT_BASE_DIR: "/my_analysis_directory",
106111
SONAR_SCANNER_OS: Os.LINUX.value,
107112
SONAR_SCANNER_ARCH: Arch.X64.value,
108113
},

0 commit comments

Comments
 (0)