mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PyTest fixtures and parametrized completions tests
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
|
||||
#
|
||||
@pytest.fixture
|
||||
def my_fixture():
|
||||
pass
|
||||
|
||||
@pytest.fixture
|
||||
def ham(my_fixture):
|
||||
pass
|
||||
|
||||
|
||||
def test_sample_test(my_fixture):
|
||||
pass
|
||||
|
||||
@pytest.mark.parametrize(('spam,eggs'), [(1,1), (2,3), (3,3)])
|
||||
@pytest.mark.parametrize('first,second', [(1,1), (2,3), (3,3)])
|
||||
def test_sample(spam,eggs,first,second):
|
||||
pass
|
||||
@@ -0,0 +1,11 @@
|
||||
import pytest
|
||||
|
||||
#
|
||||
@pytest.fixture
|
||||
def foo():
|
||||
pass
|
||||
|
||||
@pytest.mark.parametrize(('spam,eggs'), [(1,1), (2,3), (3,3)])
|
||||
@pytest.mark.parametrize('first,second', [(1,1), (2,3), (3,3)])
|
||||
def test_sample(<weak_warning descr="Parameter 'apple' value is not used">apple</weak_warning>, foo, spam<warning descr="Following arguments are not declared but provided by decorator: [eggs, first, second]">)</warning>:
|
||||
pass
|
||||
@@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
|
||||
#
|
||||
@pytest.fixture
|
||||
def my_fixture():
|
||||
pass
|
||||
|
||||
@pytest.fixture
|
||||
def ham(my_fixt<caret>):
|
||||
pass
|
||||
|
||||
|
||||
def test_sample_test(my_fixt<caret>):
|
||||
pass
|
||||
|
||||
@pytest.mark.parametrize(('spam,eggs'), [(1,1), (2,3), (3,3)])
|
||||
@pytest.mark.parametrize('first,second', [(1,1), (2,3), (3,3)])
|
||||
def test_sample(spa<caret>,egg<caret>,firs<caret>,secon<caret>):
|
||||
pass
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.jetbrains.python.testing
|
||||
|
||||
import com.jetbrains.python.PyNames
|
||||
import com.jetbrains.python.fixtures.PyTestCase
|
||||
import com.jetbrains.python.inspections.PyUnusedLocalInspection
|
||||
import com.jetbrains.python.testing.pyTestParametrized.PyTestParametrizedInspection
|
||||
|
||||
/**
|
||||
* Test py.test fixtures and paramterized completions and inspections
|
||||
*/
|
||||
class PyTestFixtureAndParametrizedTest : PyTestCase() {
|
||||
override fun getTestDataPath() = super.getTestDataPath() + "/testCompletion"
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
TestRunnerService.getInstance(myFixture.module).projectConfiguration =
|
||||
PyTestFrameworkService.getSdkReadableNameByFramework(PyNames.PY_TEST)
|
||||
}
|
||||
|
||||
fun testInspection() {
|
||||
myFixture.copyDirectoryToProject(".", ".")
|
||||
myFixture.configureByFile("test_for_inspection_test.py")
|
||||
myFixture.enableInspections(PyUnusedLocalInspection::class.java, PyTestParametrizedInspection::class.java)
|
||||
myFixture.checkHighlighting(true, false, true)
|
||||
}
|
||||
|
||||
fun testCompletion() {
|
||||
|
||||
myFixture.copyDirectoryToProject(".", ".")
|
||||
myFixture.configureByFile("test_test.py")
|
||||
myFixture.completeBasicAllCarets(null)
|
||||
myFixture.checkResultByFile("after_test_test.txt")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user