sapling/eden/integration/hg/revert_test.py
Adam Simpkins c3ebc91fdc update hg integration test inheritance to allow type checking
Summary:
Python 3 type checking currently complains about most of our integration
testing since the tests use an `hg_test` decorator to inherit from the base
test class.  This prevents the type checker from being able to figure out this
inheritance.

This updates all of the test cases to explicitly derive from the test case base
class, rather than using the decorator to do so.  I also renamed the base test
case class to `EdenHgTestCase` to be slightly more succinct and to follow the
common pattern of calling `unittest.TestCase` subclasses `FooTestCase`

Reviewed By: bolinfest

Differential Revision: D6268258

fbshipit-source-id: 09eef2f8217932a6516f78d17dddcd35c83b73da
2017-11-07 19:04:20 -08:00

26 lines
897 B
Python

#!/usr/bin/env python3
#
# Copyright (c) 2004-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from .lib.hg_extension_test_base import EdenHgTestCase, hg_test
@hg_test
class RevertTest(EdenHgTestCase):
def populate_backing_repo(self, repo):
repo.write_file('hello.txt', 'hola')
repo.commit('Initial commit.\n')
def test_make_local_change_and_attempt_revert(self):
self.write_file('hello.txt', 'hello')
self.assert_status({'hello.txt': 'M'})
self.hg('revert', '--no-backup', 'hello.txt')
self.assert_status_empty()
txt_contents = self.read_file('hello.txt')
self.assertEqual('hola', txt_contents)