When running tests with Pytest is there a flag which will show a countdown of tests not yet ran? - pytest

To elaborate,
platform linux -- Python 3.6.3, pytest-3.2.3, py-1.4.34, pluggy-0.4.0 -- /root/Python-3.6.3/python
cachedir: .cache
rootdir: X
Automation/Orders-Testing, inifile:
plugins: allure-adaptor-1.7.8
collecting ... collected 539 items
Above I have 539 tests. As these tests are executed I would like to know the remaining number. 538, 537, 536 etc to be print out to the command line.

Related

Error installing module File::NFSLock with perl from conda

I installed perl from conda and fixed installation to be able to install modules via cpanm following instructions from: Unable to install perl modules via cpanm in conda environments
Unfortunately, I wasn't still able to properly install File::NFSLock module both with cipanm and manually (perl Makefile.PL) unless I use --force --notest. The problem is that tests fail with:
# Failed test at t/300_bl_sh.t line 115.
Shared locks not running simultaneously at t/300_bl_sh.t line 116, <$rd3> line 18.
# Looks like your test exited with 4 just after 27.
t/300_bl_sh.t ..... Dubious, test returned 4 (wstat 1024, 0x400)
Failed 47/73 subtests
t/400_kill.t ...... ok
t/410_die.t ....... ok
t/420_crash.t ..... ok
t/430_taint.t ..... ok
Test Summary Report
-------------------
t/300_bl_sh.t (Wstat: 1024 Tests: 27 Failed: 1)
Failed test: 27
Non-zero exit status: 4
Parse errors: Bad plan. You planned 73 tests but ran 27.
I'm working on an nfs4 filesystem. Can there be any possible issue in using this module in this filesystem even if some tests failed?

trouble installing Tkx perl module in Ubuntu 14.04

In order to install a package called PrimerMapper for designing primers on Ubuntu 14.04, I need to install a perl module called Tkx but facing trouble in installing it. So, kindly assist me in resolving this bug.
For your quick and easy reference, I am pasting complete commands of installation. Thanks a lot
**adnan#adnan-Inspiron-N5110[Tkx-1.09]** sudo perl Makefile.PL
Writing Makefile for Tkx
Writing MYMETA.yml and MYMETA.json
**adnan#adnan-Inspiron-N5110[Tkx-1.09]** sudo make
Skip blib/lib/Tkx/Tutorial.pod (unchanged)
Skip blib/lib/Tkx.pm (unchanged)
Skip blib/lib/Tkx/MegaConfig.pm (unchanged)
Skip blib/lib/Tkx/LabEntry.pm (unchanged)
cp tkx-prove blib/script/tkx-prove
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/tkx-prove
cp tkx-ed blib/script/tkx-ed
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/tkx-ed
Manifying blib/man1/tkx-ed.1p
Manifying blib/man3/Tkx::MegaConfig.3pm
Manifying blib/man3/Tkx::LabEntry.3pm
Manifying blib/man3/Tkx::Tutorial.3pm
Manifying blib/man3/Tkx.3pm
**adnan#adnan-Inspiron-N5110[Tkx-1.09]** sudo make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/LabEntry.t ...... 1/2 (in cleanup) Can't call method "DeleteCommand" on an undefined value at /usr/local/lib/perl/5.18.2/Tcl.pm line 655 during global destruction.
t/LabEntry.t ...... ok
t/mega-config.t ... ok
t/mega.t .......... ok
t/nul-char.t ...... ok
t/tcl-callback.t .. 1/7 (in cleanup) Can't call method "DeleteCommand" on an undefined value at /usr/local/lib/perl/5.18.2/Tcl.pm line 655 during global destruction.
t/tcl-callback.t .. ok
t/tcl.t ........... 1/18 # Test 18 got: "Tcl error 'Foo at /usr/local/lib/perl/5.18.2/Tcl.pm line 585.\n' while invoking scalar result call:\n\t\"error Foo\" at /usr/local/lib/perl/5.18.2/Tcl.pm line 588.\n\tTcl::call('Tcl=SCALAR(0x1b2ce48)', 'error', 'Foo') called at /media/windows/NGS/GATK_FINAL_PIPELINE/PrimerMapper-master/Tkx-1.09/blib/lib/Tkx.pm line 329\n\teval {...} called at /media/windows/NGS/GATK_FINAL_PIPELINE/PrimerMapper-master/Tkx-1.09/blib/lib/Tkx.pm line 329\n\tTkx::i::call('error', 'Foo') called at /media/windows/NGS/GATK_FINAL_PIPELINE/PrimerMapper-master/Tkx-1.09/blib/lib/Tkx.pm line 51\n\tTkx::AUTOLOAD('Foo') called at t/tcl.t line 38\n\teval {...} called at t/tcl.t line 38\n" (t/tcl.t at line 39)
# Expected: "Foo at t/tcl.t line 38.\n"
# t/tcl.t line 39 is: ok($#, "Foo at #{[__FILE__]} line #{[__LINE__ - 1]}.\n");
t/tcl.t ........... Failed 1/18 subtests
t/tk.t ............ 12/12 (in cleanup) Can't call method "DeleteCommand" on an undefined value at /usr/local/lib/perl/5.18.2/Tcl.pm line 655 during global destruction.
t/tk.t ............ ok
t/utf8.t .......... ok
Test Summary Report
-------------------
t/tcl.t (Wstat: 0 Tests: 18 Failed: 1)
Failed test: 18
Files=8, Tests=54, 9 wallclock secs ( 0.15 usr 0.03 sys + 1.85 cusr 0.31 csys = 2.34 CPU)
Result: FAIL
Failed 1/8 test programs. 1/54 subtests failed.
make: *** [test_dynamic] Error 255
GAAS/Tkx-1.09.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports GAAS/Tkx-1.09.tar.gz
Running make install
make test had returned bad status, won't install without force
Failed during this command:
GAAS/Tkx-1.09.tar.gz : make_test NO
The error is that the tests of the module don't pass successfully.
One thing I would try first is to try to install the module with cpan or cpanminus (cpan Tkx or cpanm Tkx). You (or the Makefile.PL) may have missed something that could be causing this error.
I see you already opened a bug report on CPAN. You can see in cpantesters that this module has the tests broken (you could check with your particular Perl version) and there is also another bug report from 5 years ago reporting broken tests for the very same version that's currently on CPAN (1.09).
Considering this I think your options is to skip the tests and see if it works for your purposes.
I recently adopted Tkx and published release 1.10, which allows installation to proceed despite the t/tcl.t test 18 failure.
The test failure appears to have been caused by unexpected but minor changes to error message formatting in newer Tcl.pm. Pending the issue actually being fixed, it is not something which Tkx should abort installation over.
There's already a packaged version of Tkx for Ubuntu, so all it should take to get Tkx and any of its dependencies is:
sudo apt-get install libperl-tkx

PyTest Suppress Results Debug Statement

I am using PyTest with the following options: -s, -v, and --resultlog=results.txt. This suppresses print statements from my test, but prints the test names and results as they are run and logs the results to results.txt.
However, if any tests fail, I also get a spew of information containing traceback, debug, etc. Since I am logging this to a file anyway, I don't want it printed to the screen, cluttering up my output.
Is there any way to disable the printing of just these debug statements, but still have it logged to my results file?
Visual example:
Currently, I see something like this:
$ py.test -sv --resultlog=results.txt test.py
=============================== test session starts =========================
platform darwin -- Python 2.7.10, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- /...
cachedir: .cache
rootdir: /Users/jdinkel/Documents, inifile:
plugins: profiling-1.1.1, session2file-0.1.9
collected 3 items
test.py::TestClass::test1 PASSED
test.py::TestClass::test2 PASSED
test.py::TestClass::test3 FAILED
===================================== FAILURES ==============================
__________________________________ TestClass.test3 __________________________
self = <test.TestClass instance at 0x10beb5320>
def test3(self):
> assert 0
E assert 0
test.py:7: AssertionError
========================== 1 failed, 2 passed in 0.01 seconds ===============
But I would like to see this:
$ py.test -sv --resultlog=results.txt test.py
=============================== test session starts =========================
platform darwin -- Python 2.7.10, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- /...
cachedir: .cache
rootdir: /Users/jdinkel/Documents, inifile:
plugins: profiling-1.1.1, session2file-0.1.9
collected 3 items
test.py::TestClass::test1 PASSED
test.py::TestClass::test2 PASSED
test.py::TestClass::test3 FAILED
========================== 1 failed, 2 passed in 0.01 seconds ===============
With no change to the results.txt file.
You should use tb switch for controlling traceback.
e.g.
pytest tests/ -sv --tb=no --disable-warnings
--disable-warnings disable occasional pytest warnings which I assume you don't want either.
From pytest help:
--tb=style traceback print mode (auto/long/short/line/native/no).
In addition to the answer of #SilentGuy, -r N suppresses the summary of failed testcases.

1 test fail during perl make test

I'm trying to install Perl-5.8.3 on RHEL4U9.
At the end of 'make test', it indicates 1 test is failed. How do I fix it to make it passes all tests? Or should I just ignore it?
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
../lib/File/Find/t/find.t 189 5 2.65% 161 173 183-184 189
55 tests and 345 subtests skipped.
Output of prove -v:
# prove -v ../lib/File/Find/t/find.t
../lib/File/Find/t/find....Perl lib version (v5.8.3) doesn't match executable version (v5.8.8) at ../lib/Config.pm line 32.
Compilation failed in require at ../lib/File/Find.pm line 1223.
Compilation failed in require at ../lib/File/Find/t/find.t line 48.
BEGIN failed--compilation aborted at ../lib/File/Find/t/find.t line 50.
dubious
Test returned status 255 (wstat 65280, 0xff00)
FAILED--1 test script could be run, alas--no output ever seen

How can I install HTML-Parser-3.64 on Perl 5.6?

I am trying to install HTML-Parser-3.64 and I get following report while running make test:
ERL_DL_NONLAZY=1 /home/Perl/bin/perl -Iblib/arch -Iblib/lib -I/home/Perl/5.6.1-nothread/lib/perl5/5.6.1/sun4.SVR4 -I/home/Perl/5.6.1-nothread/lib/perl5/5.6.1 -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests #ARGV;' t/*.t
t/api_version........ok
t/argspec-bad........ok
t/argspec............ok
t/argspec2...........ok
t/attr-encoded.......ok
t/callback...........ok
t/case-sensitive.....ok
t/cases..............ok
t/comment............ok
t/crashme............ok
t/declaration........ok
t/default............ok
t/document...........ok
t/dtext..............ok
t/entities...........ok 1/17
t/entities...........NOK 17# Failed test (t/entities.t at line 74)
# got: 'Attention Home&#959&#969n&#1257rs...1&#1109t T&#1110&#1084e E&#957&#1257&#1075'
# expected: 'Attention HomeοÏnÓ©rs...1Ñt TÑмe Eνөг'
# Looks like you failed 1 test of 17.
t/entities...........dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 17
Failed 1/17 tests, 94.12% okay
t/entities2..........ok
t/filter-methods.....ok
t/filter.............ok
t/handler-eof........ok
t/handler............ok
t/headparser-http....ok
t/headparser.........ok
4/15 skipped: Need Unicode support
t/ignore.............ok
t/largetags..........ok
t/linkextor-base.....ok
t/linkextor-rel......ok
t/magic..............ok
t/marked-sect........ok
t/msie-compat........ok
t/offset.............ok
t/options............ok
t/parsefile..........ok
t/parser.............ok
t/plaintext..........ok
t/pod................skipped
all skipped: Test::Pod 1.00 required for testing POD
t/process............ok
t/pullparser.........ok
t/script.............ok
t/skipped-text.......ok
t/stack-realloc......ok
t/textarea...........ok
t/threads............skipped
all skipped: Not configured for threads
t/tokeparser.........ok
t/uentities..........ok 1/26# Looks like you planned 26 tests but ran 1 extra.
t/uentities..........dubious
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 27
Failed 1/26 tests, 96.15% okay (less 27 skipped tests: -2 okay, -7.69%)
t/unbroken-text......ok
t/unicode-bom........ok
2/2 skipped: This perl does not support Unicode
t/unicode............skipped
all skipped: This perl does not support Unicode
t/xml-mode...........ok
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t/entities.t 1 256 17 1 5.88% 17
t/uentities.t 1 256 26 1 3.85% 27
3 tests and 33 subtests skipped.
Failed 2/48 test scripts, 95.83% okay. 0/338 subtests failed, 100.00% okay.
*** Error code 11
make: Fatal error: Command failed for target `test_dynamic'
I have Perl version 5.6.1. and 3.64 version of Parser on Solaris 8.
I have seen following similar error reported by another person on internet at http://www.cpantesters.org/cpan/report/6653478. But could not see any reply or solution for that.
If you are comfortable with the other test results, and you don't expect to use HTML::Parser for pages which require extended character sets, then you can force an install.
From command-line:
$ perl -MCPAN -e 'force install HTML::Parser'
From CPAN command line:
cpan> force install HTML::Parser
From your build directory (if you'd rather not use CPAN):
mv t/entities.t t/entities.tt
mv t/uentities.t t/uentities.tt
make install
You need to report it to HTML::Parser bug tracker. Cpantesters results are only reports, in many cases automatic, so to gain attention of author you need to use bug tracker.
P.S. Upgrading is also a good idea (in case you have no problems of doing this) - Perl has changed much in 9 years from 5.6.1.