Getting author tests to be created and run for dzil test - perl

I am trying to use several Dist::Zilla plugins to generate and run author tests. The only problem is that they are generated by dzil build and not run with dzil test. As an example, here are some lines in my dist.ini:
[Test::Compile] ; Create t/00-compile.t
[Test::UnusedVars] ; Create xt/unused-vars.t
[RunExtraTests] ; run the xt/ tests when dzil test is run.
Running dzil test however, only runs one of the created test files- 00-compile.t. unused-vars.t isn't even created until I run dzil build. In order to test all of the author tests created like this, I need to first run dzil build, cd into the new directory, then run dzil test. Then, when something fails, I have to work with the original copy, not the copy created by the build command. Rinse and repeat.
Is there a way to get the author tests to be generated at build time so that I can run them with dzil test without changing directories?

dzil test --release is what you're looking for.
And I would also strongly recommend you to try Dist::Zilla::PluginBundle::TestingMania

Related

How to run only xUnit tests with specific name through console/powershell?

I am currently running tests through Visual Studio interface, and that provides easy option to run only certain test. I want to do same, but through console / powershell.
Right now if I do dotnet test that will run all discovered tests. Is it possible to do something similar like dotnet test MyTest which would only run specific test?
Command dotnet test has switch --filter that allows you to filter tests and get only those that you want to run. So you can do:
dotnet test -t
To see full list of tests available, and then in order to just run specific ones you can do:
dotnet test --filter "FullyQualifiedName~ShouldInterconnect"
Which will execute only the tests containing ShouldInterconnect in the name.

How do get pytest to do discovery based on module name, and not path

I'm looking at moving from unittest to pytest. One thing I like to do, is to do a setup.py install and then run the tests from the installed modules, rather than directly from the source code. This means that I pick up any files I've forgotten to include in MANIFEST.in.
With unittest, I can get the test runner to do test discovery by specifying the root test module. e.g. python -m unittest myproj.tests
Is there a way to do this with pytest?
I'm using the following hack, but I wish there was a built in cleaner way.
pytest $(python -c 'import myproj.tests; print(myproj.tests.__path__[0])')
The Tests as part of application section of pytest good practices says if your tests are available at myproj.tests, run:
py.test --pyargs myproj.tests
With pytest you can instead specify the path to the root test directory. It will run all the tests that pytest is able to discover. You can find more detail in the pytest good practices

How can I combine the PyDev unit test runner with Web2py?

I'm using Eclipse/PyDev on a Web2py application, and I'd like to create a launch configuration that runs a unit test using web2py.
Normally, Web2py wants you to run a unit test with a test runner script, like so:
python web2py.py -S testa -M -R testRunner.py
testRunner.py includes a main method that runs:
unittest.TextTestRunner(verbosity=2).run(suite)
However, in PyDev, the test running is managed outside of your source, in pysrc\runfiles.py.
PyDev's test runner doesn't even take -S, -M, and -R as arguments, and it has no way of passing them on to web2py.py, which it expects to be a suite of tests, and not a runner.
Is there a way to test Web2py using a PyDev unittest configuration, and if so, how?
My suggestion in this case is using the pytest runner (configure it in the pyunit preferences)... I haven't searched, but I bet there's some plugin for running web2py with pytest.

How to debug %post with rpmbuild

I'm building an RPM that needs to run a number of scripts to configure it after it's been installed to complete the installation. I have to run the scripts in the %post section because the configuration is dependent upon the type of host. All this is fairly easy and well, but every time I run into a bug with the %post section, I have to rebuild the entire package which takes about 20 minutes. Is there a way to skip recompiling everything and just build a new package with just the changes from %post?
If your spec file doesn't create a random build directory and won't delete that build tree afterwards, the more time consuming compiling can be omitted by make. I.e. Similar to not using the --clean option in rpmbuild.
You can then also use the --short-circuit flag to rpmbuild to skip the first stages in building.
Is the script doing something different when run manually vs. run from the RPM install? You can make a test RPM that has no %post, then manually run the script under test (as root). Do this on every host type that needs to be tested until you think you got it. Then add it as the %post and give it a try.

How to further automate Teamcity

I have successfully configured my project for build in TeamCity. Going a step more, I want to run a deployment script once a build completes successfully. The deployment script is a simple bash command. To make the question more simpler, how would I invoke a shell command once a build successfully completes in Teamcity.
Please help
TeamCity 6.0 has a new feature called Multiple Build Steps:
Multiple Build Steps: Now any build configuration can be comprised of unlimited number of build steps, where each step is represented by a build runner. Don’t limit yourself, and combine as many build runners into one configuration as you need. Feel free to call a NAnt script before compiling VS solutions, run inspections and duplicates finder after your ANT build, add NUnit tests after your Rake build, and so on.
So you can add a new build step with the command line runner which will execute your shell script.