Esempio n. 1
0
    def test_retrieveMsvsOnLinux(self):
        self.patchObject(platform, platform.system.__name__, return_value="Linux")

        crawler = BuildToolsCrawler()

        self.assertEqual(None, crawler.retrieveMsvs())
        self.assertCalls(self.msvsTools, [])
Esempio n. 2
0
    def test_retrieveMsvsOnWindows(self):
        self.patchObject(platform, platform.system.__name__, return_value="Windows")

        crawler = BuildToolsCrawler()

        self.assertEqual(self.msvsTools.return_value, crawler.retrieveMsvs())
        self.msvsTools.assert_has_calls([call(self.configuration)])
 def __init__(self, contents, *args):
     """
     :type contents: StatMakefileProject
     """
     super(MsvsWriter, self).__init__(contents, args)
     tools = BuildToolsCrawler().retrieveMsvs()
     if isinstance(tools, MsvsTools):
         writer = Msvs2010ProjectWriter if tools.year >= 2010 else MsvsLegacyWriter
         self._instances.append(writer(contents, tools))
     else:
         raise MsvsIdeWriterException(
             "No workspace was created due to lack of MSVS.")
    def __constructVariablesInitialization(self):
        def _formatAssignment(_variable, _value):
            return '{0} = {1}'.format(_variable, _value)

        def _getValues(*_valueSets):
            return [
                _formatAssignment(_key, _values[_key])
                for _values in _valueSets for _key in iter(_values)
            ]

        values = [
            _formatAssignment(StatMakefile.OS, platform.system()),
            _formatAssignment(StatMakefile.NAME, self.__targetName),
            _formatAssignment(StatMakefile.EXEC,
                              nameExecutable(self.__targetName))
        ]
        values += _getValues(StatConfiguration(),
                             BuildToolsCrawler().getBuildAttributes())
        return '\n'.join(values)
Esempio n. 5
0
    def test_getAttributesOnLinux(self):
        self.patchObject(platform, platform.system.__name__, return_value="Linux")

        crawler = BuildToolsCrawler()

        self.assertSameItems({}, crawler.getBuildAttributes())
Esempio n. 6
0
    def test_getAttributesOnWindowsWithMsvs(self):
        self.patchObject(platform, platform.system.__name__, return_value="Windows")

        crawler = BuildToolsCrawler()

        self.assertSameItems(TEST_MSVS_ATTRIBUTES, crawler.getBuildAttributes())
Esempio n. 7
0
 def tearDown(self):
     BuildToolsCrawler.clear()
Esempio n. 8
0
 def setUp(self):
     BuildToolsCrawler.clear()
     self.configuration = Configuration()
     self.patch(CUT, StatConfiguration.__name__, return_value=self.configuration)
     self.msvsTools = self.patch(CUT, MsvsTools.__name__)
     self.msvsTools.return_value.getAttributes.return_value = TEST_MSVS_ATTRIBUTES