From c44763c183a2251ff547bbfbd627ec32027d43bd Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Mon, 11 Jul 2016 15:45:27 +0300 Subject: [PATCH] Update PyPropertyAccessInspectionTest to run tests with both Pythons --- .../PyPropertyAccessInspectionTest.java | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/python/testSrc/com/jetbrains/python/inspections/PyPropertyAccessInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyPropertyAccessInspectionTest.java index 21101df33545..34938bb560d3 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyPropertyAccessInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyPropertyAccessInspectionTest.java @@ -15,9 +15,14 @@ */ package com.jetbrains.python.inspections; +import com.intellij.openapi.application.WriteAction; +import com.intellij.openapi.vfs.VirtualFile; import com.jetbrains.python.fixtures.PyTestCase; import com.jetbrains.python.psi.LanguageLevel; +import java.io.IOException; +import java.io.UncheckedIOException; + /** * @author yole */ @@ -34,11 +39,13 @@ public class PyPropertyAccessInspectionTest extends PyTestCase { // PY-12773 public void testClassAttrAssignmentAndSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testClassAttrAssignmentAndSlotsWithDict() { doTestPy2(); + doTestPy3(); } // PY-12773 @@ -54,41 +61,49 @@ public class PyPropertyAccessInspectionTest extends PyTestCase { // PY-12773 public void testInheritedClassAttrAssignmentAndInheritedSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testClassAttrAssignmentAndInheritedSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testInheritedClassAttrAssignmentAndOwnSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testClassAttrAssignmentAndOwnSlotsAndEmptyParent() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testClassAttrAssignmentAndOwnAndInheritedSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testClassAttrAssignmentAndOwnWithDictAndInheritedSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testClassAttrAssignmentAndOwnWithDictAndInheritedWithAttrSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testClassAttrAssignmentAndOwnAndInheritedWithDictSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 @@ -104,31 +119,37 @@ public class PyPropertyAccessInspectionTest extends PyTestCase { // PY-12773 public void testClassAttrAssignmentAndOwnAndInheritedWithAttrSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testClassAttrAssignmentAndOwnAndInheritedWithAttrAndDictSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testInheritedClassAttrAssignmentAndOwnAndInheritedSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testInheritedClassAttrAssignmentAndOwnWithAttrAndInheritedSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testInheritedClassAttrAssignmentAndOwnWithDictAndInheritedSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testInheritedClassAttrAssignmentAndOwnWithAttrAndDictAndInheritedSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 @@ -144,21 +165,25 @@ public class PyPropertyAccessInspectionTest extends PyTestCase { // PY-12773 public void testInheritedClassAttrAssignmentAndOwnAndInheritedWithDictSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testInheritedClassAttrAssignmentAndOwnAndInheritedWithAttrAndDictSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testInheritedClassAttrAssignmentAndOwnWithAttrAndInheritedWithDictSlots() { doTestPy2(); + doTestPy3(); } // PY-12773 public void testInheritedClassAttrAssignmentAndOwnWithDictAndInheritedWithAttrSlots() { doTestPy2(); + doTestPy3(); } private void doTestPy2() { @@ -170,7 +195,19 @@ public class PyPropertyAccessInspectionTest extends PyTestCase { } private void doTestPy() { - myFixture.configureByFile("inspections/PyPropertyAccessInspection/" + getTestName(true) + ".py"); + final String path = "inspections/PyPropertyAccessInspection/" + getTestName(true) + ".py"; + + final VirtualFile file = myFixture.getTempDirFixture().getFile(path); + if (file != null) { + try { + WriteAction.run(() -> file.delete(this)); + } + catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + myFixture.configureByFile(path); myFixture.enableInspections(PyPropertyAccessInspection.class); myFixture.checkHighlighting(true, false, false); }