Пример #1
0
    def test_create_gendir(self, os_mock):
        my_env = {}

        def setitem(name, val):
            my_env[name] = val

        buildConfig = BuildConfig()

        buildConfig._genroot_dir = r"C:\Users\i079877\TEMP"
        prelude.exists = MagicMock(return_value=False)
        prelude.makedirs = MagicMock(return_value=None)
        os_mock.environ.__setitem__.side_effect = setitem
        prelude.create_gendir(buildConfig)

        assert(prelude.exists.call_count == 2)
        assert(prelude.makedirs.call_count == 2)
        os_mock.environ.__setitem__.assert_has_calls([call('TMP', buildConfig.temp_dir()), call('TEMP', buildConfig.temp_dir()), call('TMPDIR', buildConfig.temp_dir())], any_order=True)