-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Skip tests instead of fail'ing if VCS <foo> command not installed #42
Conversation
I'm not sure about this: I don't want to accidentally break bzr support just because I forgot to install bzr on my dev or CI machine and the tests got skipped. I wouldn't mind replacing the four obscure failures with one clear one ("cannot test bzr support: bzr is not installed"). I probably wouldn't even mind having that not be a failure (i.e. exit code 0) so end-users can check if check-manifest works on their machine, for the subset of version control systems they want to use; as long as there's a way to require all version control systems on a CI machine (e.g. by setting an environment variable). Would you care to prepare a pull request? |
I'm more concerned about the behavior of check-manifest itself: if you run it on a bzr checkout but don't have bzr installed, is there a clear error message or an obscure traceback? (I'm guessing the latter and I'd like to change it to the former.) |
It's not just bzr support however, its any of the VCS commands, in any combination. I was going to suggest requiring bzr, svn, hg and git as a past of tests_require, but I can't think of how since they're not Python packages. The canonical example/comparison of a package that does this is SQLAlchemy, which supports many database backends. The test suite passes for any databases you have installed, and skips those you don't. I note in unittest skipping, that "TestCase.setUp() can also skip the test. This is useful when a resource that needs to be set up is not available." This might be the way to go to cover all vcs-foo unit tests with the same skip. In terms of your desire to want all four installed for your own (as author) QA & pre-release testing, that's definitely important for your own development process. I would wrap that logic up in your Makefile, which is the most appropriate place for it. If you didn't have a Makefile, your test runner (tox, travis, etc) would be. Re a pull request, I don't have the requisite Python skills to write up the method to portably check for the existence of a file using subprocess, but I'm sure someone has solved that already. Perhaps pip (which supports bzr, hg, svn and git) does already? Edit: Regarding the behaviour of check-manifest itself I agree, it should spit out a pretty error. |
I'll see what I can do. |
Champion :) |
The PR is preliminar: I checked that the tests get skipped if git isn't installed, but I haven't added the bit where I can ask Travis (or my Jenkins) to fail if any tests were skipped. On Python 2.6 the test output is rather ugly:
I suppose I can live with that. |
Very nice 👍 |
This is so that I can detect problems with my CI server environment.
I'm down the rabbit hole. TestCheckManifest relies on git being available. Options:
I tried approach 2 because it seemed friendlier and discovered that
So perhaps I should be running TestCheckManifest four times, with all four version control systems (skipping the ones that aren't installed)? |
The tests will pick any of git/hg/bzr/svn, whichever is available. You can force the selection by setting FORCE_TEST_VCS. Slight downside to this: - TestCheckManifest.test_missing_source_files fails with bzr/hg - TestCheckManifest.test_relative_{pathname,python} fail with svn I'll now investigate if those are real bugs. I wonder if I should add a Travis matrix for forcing all the VCS systems?
Originally the idea was that I'd define an abstract VCS interface, test that, and then test the main logic using any of the VCSes. In practice I discovered that some main tests fail with some of the VCSes, which means my abstractions are leaking somewhere.
The bug was in the test: it assumed self._vcs._init_vcs() wouldn't change the current working directory.
This makes it behave the same way as with Git, and makes tests failed with FORCE_TEST_VCS=hg. AFAICT the original bug (#32) never affected Mercurial repositories, so the user-visible change is merely cosmetic.
"So perhaps I should be running TestCheckManifest four times, with all four version control systems (skipping the ones that aren't installed)?" This ^^^ 👍 Unitize your tests :) |
"Fix" here means "skip the unimportant part of the test that fails", since it's only a cosmetic feature.
Skip tests instead of failing if VCS <foo> command not installed
I have svn, hg and git installed, but not bzr. Any VCS tests will currently fail due to a missing command. Eg: If a user only uses git, svn, hg and bzr tests will fail.
They should instead be skipped with an appropriate message: "skipping . 'foo' command not installed" or equivalent.