Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define an api module #20

Open
goanpeca opened this issue Oct 25, 2016 · 5 comments
Open

Define an api module #20

goanpeca opened this issue Oct 25, 2016 · 5 comments

Comments

@goanpeca
Copy link
Member

The idea for the new api decoupling is that every plugin on spyder (even third party) or at least the one we make, should include an api module and define there any public api we want to expose.

Since this is a language related plugin, I need to brief you a bit on how I think we can handle that.

But so far we need to have a language agnostic functionality assuming that a unit test suite gives a list of tests (failed, passed, xfailed, xpassed) plus some optional coverage.

@jitseniesen
Copy link
Member

It's not quite clear to me how this will work, so I will wait until you converted at least one other plugin 😉 Should the interface between Spyder and the plugin be part of the api module? I'm finding it hard to think of a use case where another plugin needs to interface with this plugin.

Running tests takes a while so the API needs to be asynchronous.

The plugin is actually almost language agnostic. The Python specific parts are the definition of the different testing frameworks (py.test, nose, unittest, etc., though only the first one works at the moment) and some special handling of pythonpath.

Implementation of coverage is still quite far off.

@goanpeca
Copy link
Member Author

It's not quite clear to me how this will work, so I will wait until you converted at least one other plugin 😉 Should the interface between Spyder and the plugin be part of the api module? I'm finding it hard to think of a use case where another plugin needs to interface with this plugin.

Agreed, I am still working on that proposal to get feedback. But the general idea is that all plugins will have an api and that is point of extension.

For a basic idea you can look at https://github.com/spyder-ide/spyder/wiki/API-decoupling

Running tests takes a while so the API needs to be asynchronous.

Sure, we need to have a runner/worker for this...

The plugin is actually almost language agnostic. The Python specific parts are the definition of the different testing frameworks (py.test, nose, unittest, etc., though only the first one works at the moment) and some special handling of pythonpath.

The general idea is to define the basic agnostic api and a Manager that will take care of the registration of new languages.

I would even say that since this is something of common use, I would make the generic parts part of spyder and only define the specific python ones either in this package, or as part of the

spyder_python package (that will by default be part of spyder).

So if someone want to create an extension of this plugin for another language they use the api.

from spyder.api import unit_test

class SomeOtherLanguage(unit_test.BaseWidget):
   def some_common_use_api(self):
       pass

api.unit_test.register(R', SomeOtherLanguage)

The available languages should come from the spyder API, so that we are sure we give gradual support.

@goanpeca
Copy link
Member Author

goanpeca commented Oct 26, 2016

Another option would be to leave this as a separate package that defines the two submodules

spyder_unitest
    spyder_unitest
    spyder_unittest_python

Or something

@jitseniesen
Copy link
Member

My plan was for the widget to be agnostic, and to define a TestRunner class for every test framework (that's what #9 is about):

class BaseTestRunner(QObject):
    sig_test_results = Signal(something)
    def run_tests(basedir):
        """Run tests and emit sig_test_results with results as they come in."""
        raise NotImplementedException

The plugin would then define subclasses for every unit test framework. That should be quite easy to combine with register() as you propose; the main thing to keep in mind is that a programming language will have multiple test frameworks.

@goanpeca
Copy link
Member Author

Awesome, yes this is the general idea :-) looks good. Sure we need to register language and test framework...

So either the TestRunner defines a class variable with the info, or that is provided upon registry :-)

@goanpeca goanpeca modified the milestone: v0.1 Oct 30, 2016
@jitseniesen jitseniesen modified the milestones: v0.1, v0.2 Jan 21, 2017
@jitseniesen jitseniesen modified the milestones: v0.2, v0.3 Aug 18, 2017
@jitseniesen jitseniesen modified the milestones: v0.3, v0.4 Jan 27, 2018
@jitseniesen jitseniesen modified the milestones: v0.4, v0.5 Dec 28, 2019
@goanpeca goanpeca removed this from the v0.5 milestone Feb 23, 2020
@jitseniesen jitseniesen added this to the v0.5.1 milestone Jan 6, 2022
@jitseniesen jitseniesen removed the v0.5.0 label Jan 6, 2022
@jitseniesen jitseniesen modified the milestones: v0.5.1, v0.5.2 Aug 17, 2022
@jitseniesen jitseniesen removed their assignment Aug 17, 2022
@jitseniesen jitseniesen modified the milestones: v0.5.2, v0.6.0 Mar 24, 2023
@jitseniesen jitseniesen removed this from the v0.6.0 milestone Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants