Skip to content

Conversation

@mblayman
Copy link
Member

This aligns better with the specification.

These tests represent a feature to be implemented or a bug to be fixed
and act as something of an executable “things to do” list. They are not
expected to succeed.

Fixes #74

This aligns better with the specification.

> These tests represent a feature to be implemented or a bug to be fixed
and act as something of an executable “things to do” list. They are not
expected to succeed.

Fixes #74
@smcv
Copy link
Contributor

smcv commented May 11, 2018

Looks good to me. This:

#!/usr/bin/python3

import tap.runner
import unittest

class T(unittest.TestCase):
    @unittest.expectedFailure
    def test_expected_failure(self):
        self.assertEqual(1, 0)

    @unittest.expectedFailure
    def test_expected_failure_but_successful(self):
        self.assertEqual(1, 1)

if __name__ == '__main__':
    runner = tap.runner.TAPTestRunner()
    runner.set_stream(True)
    unittest.main(testRunner=runner)

now correctly outputs:

# TAP results for T
not ok 1 - test_expected_failure (__main__.T) # TODO (expected failure)
# Traceback (most recent call last):
...
# AssertionError: 1 != 0
ok 2 - test_expected_failure_but_successful (__main__.T) # TODO (unexpected success)
1..2

similar to the equivalent Perl:

#!/usr/bin/perl

use warnings;
use strict;
use Test::More qw(no_plan);

TODO: {
    local $TODO = 'testing expected failures';

    is(1, 0, "this is an expected failure");
    is(0, 0, "this is an expected failure but successful");
}

done_testing;

which outputs

not ok 1 - this is an expected failure # TODO testing expected failures
#   Failed (TODO) test 'this is an expected failure'
#   at tmp.pl line 10.
#          got: '1'
#     expected: '0'
ok 2 - this is an expected failure but successful # TODO testing expected failures
1..2

@codecov-io
Copy link

codecov-io commented May 11, 2018

Codecov Report

Merging #75 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #75   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines         483    483           
=====================================
  Hits          483    483
Impacted Files Coverage Δ
tap/runner.py 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 540a1cb...969fb3e. Read the comment docs.

@mblayman
Copy link
Member Author

@smcv Thanks for the review. I've got some other branches that I would like to get merged, but I'm hoping to cut another release in the next couple of weeks. I appreciate your help!

@mblayman mblayman merged commit 13a0ed0 into master May 12, 2018
@mblayman mblayman deleted the todo-expected-failure branch May 12, 2018 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@expectedFailure decorator should result in # TODO directives

4 participants