hayd / pep8radius

PEP8 clean only the parts of the files touched since the last commit, a previous commit or (the merge-base of) a branch.
MIT License
183 stars 9 forks source link

tests todo list #25

Open hayd opened 10 years ago

hayd commented 10 years ago

The new file structure is now much less of a mess (not just one file), so should be able to more trivially tick a couple of these off / be clear where to put things.

* udiffs with lines combined and distinct lines in multiple files.

schodge commented 10 years ago

Are you supposed to just run python test_btyfi.py in the tests directory? I'm failing one and skipping one - (haven't installed Hg yet). I added in some extra print lines to make sure the path selection was working right. Oddly, however unittest is written, if I try to pipe the output to a file, I wind up with my print statements piped to a file but not the program output proper. Something about stdout and stderr mapping differently on Windows? (And yes, the os.path.dirname really does show up blank even though the next command using it works fine).

(Using the latest WinPython, gave up on Anaconda for the time being given some difficulties in getting the right packages set up.)

Shayne

C:\Users\Administrator\Desktop\btyfi-master\test>python test_btyfi.py
hello
__file__ =  test_btyfi.py
os.path.dirname(__file__) =
os.path.abspath(os.path.dirname(__file__)) =  C:\Users\Administrator\Desktop\btyfi-master\test
os.path.split(os.path.abspath(os.path.dirname(__file__))) =  ('C:\\Users\\Administrator\\Desktop\\btyfi-master', 'test')
os.path.split(os.path.abspath(os.path.dirname(__file__)))[0] =  C:\Users\Administrator\Desktop\btyfi-master
ROOT_DIR =  C:\Users\Administrator\Desktop\btyfi-master
end printing
Fs
======================================================================
FAIL: test_one_line (__main__.TestRadiusGit)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_btyfi.py", line 110, in test_one_line
    self.check(original, modified, expected, 'test_one_line')
  File "test_btyfi.py", line 70, in check
    self.assert_equal(result, expected, test_name)
  File "test_btyfi.py", line 81, in assert_equal
    self.diff(expected, result, test_name))
AssertionError:
--- test_one_line/expected
+++ test_one_line/result
@@ -5,8 +5,7 @@

 foo = 1; bar = 2; print(foo * bar)
 a = 1
-b = 42
-c = 3
+b=42; c=3
 d=7

 def f(x = 1, y = 2):

----------------------------------------------------------------------
Ran 2 tests in 0.067s

FAILED (failures=1, skipped=1)
hayd commented 10 years ago

You need to be using the latest version of autopep8 (I pushed some fixes to it, specifically one to fix the above issue, hopefully they'll release as new version soon), for now install with pip --quiet install git+git://github.com/hhatto/autopep8.git. Also hg is pip installable with pip install mercurial (I think there).

hayd commented 10 years ago

true about print statements, e.g. with nosetests you can do nosetests test_btyfi.py -s (see http://nose.readthedocs.org/en/latest/plugins/capture.html)

I find it useful to pdb.set_trace() and step through, again nosetests/py-test make this easier.

schodge commented 10 years ago

Hmm... so I can't install that way via pip for a reason I'll figure out later. I had installed via downloading the current zip of repository off github and giving it to WinPython's near-magical installation utility; when I checked autopep8.py in /Scripts/ it had the latest commit in it. I tried deleting autopep8.exe that was also in /Scripts/ (no clue how that gets built, also on my things to figure out later) to make sure the .py was being executed, and now we're passing.

Oh, and pip install mercurial is failing to compile at the moment.
Python on Windows can be so much fun.

Andy Hayden mailto:notifications@github.com Sunday, April 06, 2014 12:22 AM

true about print statements, e.g. with nosetests you can do |nosetests test_btyfi.py -s| (see http://nose.readthedocs.org/en/latest/plugins/capture.html)

I find it useful to pdb.set_trace() and step through, again nosetests/py-test make this easier.

— Reply to this email directly or view it on GitHub https://github.com/hayd/btyfi/issues/25#issuecomment-39661104.

hayd commented 10 years ago

sounds painful..

schodge commented 10 years ago

It turns out I'm suffering from a "critical" Python bug that is still open 4+ years later...

http://bugs.python.org/issue7511

On the bright side, it does it make it less likely any users on Windows will be trying to use this with Mercurial :)

hayd commented 10 years ago

@schodge you don't need to be in the correct directory anymore and also I changed name. Still requires git version of autopep8... but now there's a few more tests.

It's also crazy you can't pip install mercurial with python 3. You can download it for win http://mercurial.selenic.com/downloads