|
6 | 6 | Test issues related to compiled code. |
7 | 7 | """ |
8 | 8 |
|
9 | | -from iptest import IronPythonTestCase, run_test |
| 9 | +import os |
| 10 | +import unittest |
| 11 | + |
| 12 | +from iptest import IronPythonTestCase, is_netcoreapp, skipUnlessIronPython, run_test |
10 | 13 |
|
11 | 14 | class RegressionCompiledTest(IronPythonTestCase): |
12 | 15 | def test_gh_ipy2_563(self): |
13 | 16 | """https://github.com/IronLanguages/ironpython2/issues/563""" |
14 | 17 | eval('3.14') |
15 | 18 |
|
| 19 | + @unittest.skipIf(is_netcoreapp, 'no clr.CompileModules') |
| 20 | + @skipUnlessIronPython() |
| 21 | + def test_gh1357(self): |
| 22 | + filename = os.path.join(self.temporary_dir, 'gh1357_%d.py' % os.getpid()) |
| 23 | + dll = os.path.join(self.temporary_dir, "test_%d.dll" % os.getpid()) |
| 24 | + with open(filename, 'w') as f: |
| 25 | + f.write('{(1,): None}') |
| 26 | + |
| 27 | + import clr |
| 28 | + try: |
| 29 | + clr.CompileModules(dll, filename) |
| 30 | + except: |
| 31 | + Fail('Failed to compile the specified file') |
| 32 | + finally: |
| 33 | + os.unlink(filename) |
| 34 | + os.unlink(dll) |
| 35 | + |
| 36 | + @unittest.skipIf(is_netcoreapp, 'no clr.CompileModules') |
| 37 | + @skipUnlessIronPython() |
| 38 | + def test_ipy3_gh1601(self): |
| 39 | + filename = os.path.join(self.temporary_dir, 'test_ipy3_gh1601_%d.py' % os.getpid()) |
| 40 | + dll = os.path.join(self.temporary_dir, "test_ipy3_gh1601_%d.dll" % os.getpid()) |
| 41 | + with open(filename, 'w') as f: |
| 42 | + f.write('class MyClass:\n') |
| 43 | + f.write(' """description"""\n') |
| 44 | + |
| 45 | + import clr |
| 46 | + try: |
| 47 | + clr.CompileModules(dll, filename) |
| 48 | + except: |
| 49 | + Fail('Failed to compile the specified file') |
| 50 | + finally: |
| 51 | + os.unlink(filename) |
| 52 | + os.unlink(dll) |
| 53 | + |
16 | 54 | run_test(__name__) |
0 commit comments