On Thu, Apr 16, 2009 at 12:54:02PM +0200, Tarek Ziadé wrote:
> On Thu, Apr 16, 2009 at 12:42 PM, Floris Bruynooghe
> <floris.bruynoo...@gmail.com> wrote:
> > Do these improvements sound sensible?  And if so should I create one
> > patch for each (and two bug reports) or combine them into one patch?
>
> They sound reasonable,  please fill two differents bugs with your patches
> and if you can, add some unit tests.

Attached are new tests for the distutils.unixccompiler module, testing
the current behaviour of what I'm about to change (not testing the
entire module!).  Any comments on these tests would be appreciated,
just to make sure I'm not doing it all wrong.


> As long as you provide some support to test the final vesion on the various
> platforms (eg being a beta tester of the distutils trunk),
> I am able to work on your patches, and on the tests.

I should be able to test on some platforms (GNU/Linux-gcc,
Solaris-gcc, AIX-gcc).  Is the ditutils trunk still python 2.x trunk?


Regards
Floris

-- 
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org
import sys
import test.test_support
import unittest
from distutils import sysconfig

from distutils.unixccompiler import UnixCCompiler


class TestRuntimeLibraryDirOption(unittest.TestCase):
    def setUp(self):
        self._backup_platform = sys.platform
        self._backup_get_config_var = sysconfig.get_config_var
        class CompilerWrapper(UnixCCompiler):
            def rpath_foo(self):
                return self.runtime_library_dir_option('/foo')
        self.cc = CompilerWrapper()
        self.gcv_gcc = lambda x: 'gcc' if x == 'CC' else AssertionError()
        self.gcv_gxx = lambda x: 'g++' if x == 'CC' else AssertionError()
        self.gcv_cc = lambda x: 'cc' if x == 'CC' else AssertionError()

    def tearDown(self):
        sys.platform = self._backup_platform
        sysconfig.get_config_var = self._backup_get_config_var

    def test_darwin(self):
        sys.platform = 'darwin'
        self.assertEqual(self.cc.rpath_foo(), '-L/foo')

    def test_hpux(self):
        sys.platform = 'hp-ux'
        self.assertEqual(self.cc.rpath_foo(), '+s -L/foo')

    def test_irix646(self):
        sys.platform = 'irix646'
        self.assertEqual(self.cc.rpath_foo(), ['-rpath', '/foo'])

    def test_osf1V5(self):
        sys.platform = 'osf1V5'
        self.assertEqual(self.cc.rpath_foo(), ['-rpath', '/foo'])

    def test_gcc(self):
        sys.platform = 'bar'
        sysconfig.get_config_var = self.gcv_gcc
        self.assertEqual(self.cc.rpath_foo(), '-Wl,-R/foo')

    def test_nongcc(self):
        sys.platform = 'bar'
        sysconfig.get_config_var = self.gcv_cc
        self.assertEqual(self.cc.rpath_foo(), '-R/foo')


def test_suite():
    return unittest.makeSuite(TestRuntimeLibraryDirOption)


if __name__ == '__main__':
    test.test_support.run_unittest(test_suite())
_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to