stuartherbert / sublime-phpunit

PHPUnit Support for Sublime Text 2
https://github.com/stuartherbert/sublime-phpunit
Other
103 stars 20 forks source link

support for sublime text 3 #19

Closed billehunt closed 9 years ago

billehunt commented 11 years ago

several issues related to moving to Python 3.3

File "C:\Users\Bill\AppData\Roaming\Sublime Text 3\Packages\sublime-phpunit\phpunit.py", line 7, in <module>
    import thread
ImportError: No module named 'thread'

I commented out the import thread line to see if I could make further progress.

That leads to this not-very-helpful error:

reloading plugin sublime-phpunit.phpunit
TypeError: String required

However, the right-click phpunit options show up. I try clicking "Run these tests", and get error:

File "C:\Users\Bill\AppData\Roaming\Sublime Text 3\Packages\sublime-phpunit\phpunit.py", line 118, in clear_output_view
    edit = self.output_view.begin_edit()
TypeError: begin_edit() missing 2 required positional arguments: 'edit_token' and 'cmd'
TypeError: String required

The sublime text 3 porting guide (http://www.sublimetext.com/docs/3/porting_guide.html) says:

Restricted begin_edit() and end_edit()

begin_end() and end_edit() are no longer directory accessible, except in some special circumstances. The only way to get a valid instance of an Edit object is to place your code in a TextCommand subclass. In general, most code can be refactored by placing the code between begin_edit() and end_edit() in a TextCommand, and then calling run_command on that TextCommand.

This approach removes the issue of dangling Edit objects, and ensures the repeat command and macros work as they should.

And now I'm lost as I'm not really python-literate

billehunt commented 11 years ago

anyone out there?

This plugin is/was my favorite; really made development smooth. I've tried running the automated "2to3" utility included with Python 3, but it also gets hung up at the same problem. I've spent some time investigating, but afraid I'm stuck. The full error is:

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 399, in run_
    return self.run(edit)
  File "C:\Users\Bill\AppData\Roaming\Sublime Text 3\Packages\PHPUnit\phpunit.py", line 876, in run
    cmd.run(path, file_to_test)
  File "C:\Users\Bill\AppData\Roaming\Sublime Text 3\Packages\PHPUnit\phpunit.py", line 172, in run
    self.show_empty_output()
  File "C:\Users\Bill\AppData\Roaming\Sublime Text 3\Packages\PHPUnit\phpunit.py", line 155, in show_empty_output
    self.output_view.clear_output_view()
  File "C:\Users\Bill\AppData\Roaming\Sublime Text 3\Packages\PHPUnit\phpunit.py", line 118, in clear_output_view
    edit = self.output_view.begin_edit()
TypeError: begin_edit() missing 2 required positional arguments: 'edit_token' and 'cmd'
TypeError: String required

and line 118 in clear_output_view() is (after 2to3 runs; don't know if line numbering has changed)

edit = self.output_view.begin_edit()

In above post, I noted what SublimeText porting guide says about this.

I'm afraid I have no idea what to do with this info. I've dug some, but it's clear I'll need to learn python and the sublime text plugin world in order to go further and that's not in the cards right now.

Help! Please!

stuartherbert commented 11 years ago

Sorry, but it's going to be a while before I have time to look at porting this plugin to ST3.

stevenklar commented 11 years ago

Is it already made?

schickling commented 11 years ago

Would really appreciate an update! :+1:

billehunt commented 11 years ago

So for the benefit of others on this thread, I wrote a really simple plugin to run phpunit for all tests or just the current test file. I have extremely limited python knowledge, and even less Sublime plugin knowledge, so I'm afraid this must be unsupported by me, but if someone else wants to run with it and expand/publish it themselves, you have my blessing. (if you do, please post a link in this thread so I can use it myself, thanks)

Also, I'm on Windows so if you're on another platform, you'll have to make changes

(in file Sublime Text 3/Packages/User/PhpUnit.py) import sublime, sublime_plugin

def run_phpunit(window, additional=''): project_path = window.folders()[0] + "/tests" phpunit = "phpunit.bat --stop-on-failure -c phpunit.xml " window.run_command('exec', {'cmd': phpunit + additional, 'working_dir': project_path})

class PhpUnitAllCommand(sublime_plugin.TextCommand): def run(self, edit): run_phpunit(self.view.window())

class PhpUnitThisFileCommand(sublime_plugin.TextCommand): def run(self, edit): run_phpunit(self.view.window(), self.view.file_name())

Then, I make my user keymap: [ // PHpUnit commands { "keys": ["ctrl+t", "ctrl+a"], "command": "php_unit_all" }, { "keys": ["ctrl+t", "ctrl+t"], "command": "php_unit_this_file" } ]

On Thu, Apr 11, 2013 at 10:40 AM, schickling notifications@github.comwrote:

Would really appreciate an update! [image: :+1:]

— Reply to this email directly or view it on GitHubhttps://github.com/stuartherbert/sublime-phpunit/issues/19#issuecomment-16249937 .

stuartherbert commented 11 years ago

I'm planning on taking a look at ST3 this month.

schickling commented 11 years ago

@stuartherbert That's great! ST3 comes along with real speed improvements. And I think even the "go to test/production file" command can be simplified on your part.

lyrixx commented 11 years ago

Hello. Any news on this issue ?

adri commented 11 years ago

Hey, https://github.com/klaascuvelier/sublime-phpunit Seems to work but is not based on the latest version.

monkeymonk commented 11 years ago

Any updates ?

cyrusdavid commented 11 years ago

Hi sir, How's the ST3 version doing?

g105b commented 11 years ago

bumping for interest

monkeymonk commented 11 years ago

...no update?

stuartherbert commented 11 years ago

I've had a first look at this, and you'll find a working version in the new 'st3-support' branch. I don't yet have one code base that works with both ST2 and ST3 - that's next on the list.

g105b commented 11 years ago

I don't think that should be a requirement. -----Original Message----- From: Stuart Herbert notifications@github.com Date: Tue, 06 Aug 2013 09:56:59 To: stuartherbert/sublime-phpunitsublime-phpunit@noreply.github.com Reply-To: stuartherbert/sublime-phpunit reply@reply.github.com Cc: Greg Bowlergreg.bowler@g105b.com Subject: Re: [sublime-phpunit] support for sublime text 3 (#19)

I've had a first look at this, and you'll find a working version in the new 'st3-support' branch. I don't yet have one code base that works with both ST2 and ST3 - that's next on the list.


Reply to this email directly or view it on GitHub: https://github.com/stuartherbert/sublime-phpunit/issues/19#issuecomment-22193925

stuartherbert commented 11 years ago

It's a requirement for a couple of reasons:

cyrusdavid commented 11 years ago

Thanks for the update! :heart_eyes_cat:

matejkloska commented 11 years ago

I still have issues with ST3. Is it possible to publish stable package over Package Control plugin for easy installation?

Thanks :)

schickling commented 11 years ago

Same here @matejkloska

lucascosta commented 10 years ago

I've got a disabled menu on ST3... phpunit working fine on command line.

maxbritto commented 10 years ago

Same as lucasrcosta : I've got a disabled menu on Sublime Text 3 while phpunit is working fine on the command line and on Sublime Text 2

alairock commented 10 years ago

Confirmed.

trickleup commented 10 years ago

Same as lucasrcosta

stuartherbert commented 10 years ago

The 'develop' branch now supports ST2 and ST3 at the same time. Hoping to publish this via Package Control next week.

stuartherbert commented 10 years ago

The ST3 fixes should be showing up via Package Control shortly.

gerardroche commented 9 years ago

I'm nearing a version 1.0.0 release of an ST3 only PHPUnit plugin: https://github.com/gerardroche/sublime-phpunit.

stuartherbert commented 9 years ago

Closing as I've had no further reports of problems with ST3.