vikstrous / pirate-get

A command line interface for The Pirate Bay
GNU Affero General Public License v3.0
337 stars 53 forks source link

move version check to setup.py #87

Closed rnhmjoj closed 8 years ago

rnhmjoj commented 8 years ago

This way it should not even possible to install it on the wrong version.

vikstrous commented 8 years ago

I think we should keep a version check in the tests somewhere too just in case someone tries to run the tests on python 3.3

rnhmjoj commented 8 years ago

To run the tests you use python setup.py test, no? Shouldn't be possible either.

vikstrous commented 8 years ago

Hmm... Cricle ci uses coverage run -m unittest discover I wasn't sure if that would trigger it. Maybe we can test it by lowering the python version in circle ci to make sure it errors out as expected?

rnhmjoj commented 8 years ago

That should do it. Anyway I'm not familiar with the test suit: I don't know how/whether is possible to test the setup.py. Do I have to leave the check in pirate.py and test against it?

vikstrous commented 8 years ago

I have no idea. Maybe we can test setup.py by just importing it in the test?

rnhmjoj commented 8 years ago

Nope. Importing setup.py causes the setup interface to run; everything after import setup is not actually being loaded/executed.

python3 tests/test_version.py
usage: test_version.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: test_version.py --help [cmd1 cmd2 ...]
   or: test_version.py --help-commands
   or: test_version.py cmd --help

error: no commands supplied

EDIT: ok, I can just use __name__ == '__main__'

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.08%) to 84.63% when pulling 867333db87cbc67529dfc49b46afd97dae138f5a on version-check into 7deac793b500222282a15185e02df25d6145acba on master.

vikstrous commented 8 years ago

Looks like you got it to work. Shipit!