Search in sources :

Example 1 with BundleInfoStub

use of org.python.pydev.ui.BundleInfoStub in project Pydev by fabioz.

the class ISortTest method testJythonTests2.

public void testJythonTests2() throws Exception {
    CorePlugin.setBundleInfo(new BundleInfoStub());
    File f = new File(TestDependent.TEST_PYSRC_TESTING_LOC + "\\extendable\\isortWithoutCfg\\snippet.py");
    byte[] encoded = Files.readAllBytes(f.toPath());
    String fileContents = new String(encoded, StandardCharsets.UTF_8);
    Set<String> knownThirdParty = new HashSet<String>();
    String[] knownThirdPartyContent = new String[] { "wincertstore", "six", "cython", "wheel", "asgiref", "setuptools", "numpy", "easy_install", "mkl", "sqlparse", "PIL", "django", "pip", "pkg_resources", "certifi", "olefile", "pytz", "Cython", "mkl_fft", "pyximport" };
    for (String s : knownThirdPartyContent) {
        knownThirdParty.add(s);
    }
    for (String s : knownThirdPartyContent) {
        fileContents.concat(s);
    }
    String actual = JythonModules.makeISort(fileContents, f, knownThirdParty);
    String expected = "from __future__ import absolute_import\n" + "\n" + "import os\n" + "import sys\n" + "\n" + "from my_lib import Object, Object2, Object3\n" + "from third_party import (lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8, lib9,\n" + "                         lib10, lib11, lib12, lib13, lib14, lib15)\n" + "\n" + "print(\"Hey\")\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "print(\"yo\")\n";
    assertEquals(expected, actual);
}
Also used : BundleInfoStub(org.python.pydev.ui.BundleInfoStub) File(java.io.File) HashSet(java.util.HashSet)

Example 2 with BundleInfoStub

use of org.python.pydev.ui.BundleInfoStub in project Pydev by fabioz.

the class PythonNatureStoreTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    ProjectModulesManager.IN_TESTS = true;
    PydevPlugin.setBundleInfo(new BundleInfoStub());
    CorePlugin.setBundleInfo(new BundleInfoStub());
}
Also used : BundleInfoStub(org.python.pydev.ui.BundleInfoStub)

Example 3 with BundleInfoStub

use of org.python.pydev.ui.BundleInfoStub in project Pydev by fabioz.

the class CodeCompletionTestsBase method setUp.

/*
     * @see TestCase#setUp()
     */
@Override
public void setUp() throws Exception {
    super.setUp();
    CompletionProposalFactory.set(new DefaultCompletionProposalFactory());
    PydevPlugin.setBundleInfo(new BundleInfoStub());
    CorePlugin.setBundleInfo(new BundleInfoStub());
    ProjectModulesManager.IN_TESTS = true;
    FileUtils.IN_TESTS = true;
    PydevTestUtils.setTestPlatformStateLocation();
}
Also used : BundleInfoStub(org.python.pydev.ui.BundleInfoStub) DefaultCompletionProposalFactory(org.python.pydev.editor.codecompletion.proposals.DefaultCompletionProposalFactory)

Example 4 with BundleInfoStub

use of org.python.pydev.ui.BundleInfoStub in project Pydev by fabioz.

the class AbstractVisitorTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    PydevPlugin.setBundleInfo(new BundleInfoStub());
    CorePlugin.setBundleInfo(new BundleInfoStub());
    MODULE_NAME = "testModule";
}
Also used : BundleInfoStub(org.python.pydev.ui.BundleInfoStub)

Example 5 with BundleInfoStub

use of org.python.pydev.ui.BundleInfoStub in project Pydev by fabioz.

the class ISortTest method testJythonTests.

public void testJythonTests() throws Exception {
    CorePlugin.setBundleInfo(new BundleInfoStub());
    File f = new File(TestDependent.TEST_PYSRC_TESTING_LOC + "\\extendable\\isortWithCfg\\snippet.py");
    byte[] encoded = Files.readAllBytes(f.toPath());
    String fileContents = new String(encoded, StandardCharsets.UTF_8);
    Set<String> knownThirdParty = new HashSet<String>();
    String[] knownThirdPartyContent = new String[] { "wincertstore", "six", "cython", "wheel", "asgiref", "setuptools", "numpy", "easy_install", "mkl", "sqlparse", "PIL", "django", "pip", "pkg_resources", "certifi", "olefile", "pytz", "Cython", "mkl_fft", "pyximport" };
    for (String s : knownThirdPartyContent) {
        knownThirdParty.add(s);
    }
    for (String s : knownThirdPartyContent) {
        fileContents.concat(s);
    }
    String actual = JythonModules.makeISort(fileContents, f, knownThirdParty);
    String expected = "" + "from __future__ import absolute_import\n" + "\n" + "import os\n" + "import sys\n" + "\n" + "from my_lib import Object, Object2, Object3\n" + "from third_party import lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8, lib9, lib10, lib11, lib12, lib13, lib14, lib15\n" + "\n" + "print(\"Hey\")\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "print(\"yo\")\n";
    assertEquals(expected, actual);
}
Also used : BundleInfoStub(org.python.pydev.ui.BundleInfoStub) File(java.io.File) HashSet(java.util.HashSet)

Aggregations

BundleInfoStub (org.python.pydev.ui.BundleInfoStub)8 File (java.io.File)3 HashSet (java.util.HashSet)2 AssertionFailedError (junit.framework.AssertionFailedError)1 DefaultCompletionProposalFactory (org.python.pydev.editor.codecompletion.proposals.DefaultCompletionProposalFactory)1