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

tests todo list #25

Open
9 of 16 tasks
hayd opened this issue Apr 6, 2014 · 7 comments
Open
9 of 16 tasks

tests todo list #25

hayd opened this issue Apr 6, 2014 · 7 comments
Milestone

Comments

@hayd
Copy link
Owner

hayd commented Apr 6, 2014

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.

  • test udiff functions (extracting line numbers and removed lines) + *.
  • test diff output
  • test dry-run in-place (idea: just do a dry run in check as first thing, or alternatively do a little for loop of different configurations of diff and dry-run and ... ?)
  • example tests with * (update/note to self: wtf is *?)
  • tests for more edge cases in autopep8 line range (off topic if already in their tests?)
  • excludes and other options (?) not passed on to autopep8
  • version number
  • list-fixes
  • bad rev
  • specific rev (idea: perhaps successfully_commit... could return commit hash)
  • test against branches (not convinced there is a need to do this, as git/hg diff is doing the work here, but should confirm this ? :S ) specifically bazaar (I skip a test atm)
  • test with bad syntax
  • bad vc (passed to new)
  • no vc in directory (which_version_control raises) ... no cover ;)
  • be able to run tests (safely) without being in test directory TST call from anywhere #27
  • Potentially delete .git and .hg on tearDown (seems kindof wasteful to do this for each test, would prefer if could do on just the init setup and final tearDown?).

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

@hayd hayd added this to the someday milestone Apr 6, 2014
@schodge
Copy link
Contributor

schodge commented Apr 6, 2014

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
Copy link
Owner Author

hayd commented Apr 6, 2014

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
Copy link
Owner Author

hayd commented Apr 6, 2014

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
Copy link
Contributor

schodge commented Apr 6, 2014

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:[email protected]
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
#25 (comment).

@hayd
Copy link
Owner Author

hayd commented Apr 6, 2014

sounds painful..

@schodge
Copy link
Contributor

schodge commented Apr 7, 2014

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
Copy link
Owner Author

hayd commented Apr 8, 2014

@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

@hayd hayd modified the milestones: 0.8, someday Apr 20, 2014
@hayd hayd modified the milestones: 0.9, 0.8 May 21, 2014
@hayd hayd mentioned this issue May 21, 2014
14 tasks
@hayd hayd modified the milestones: 0.9.1, 0.9 Sep 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants