def setUp(self): self.section = Section('test section') self.uut = CheckstyleBear.CheckstyleBear(self.section, Queue()) test_files = os.path.join(os.path.dirname(__file__), 'test_files') self.good_file = os.path.join(test_files, 'CheckstyleGood.java') self.bad_file = os.path.join(test_files, 'CheckstyleBad.java') self.empty_config = os.path.join(test_files, 'checkstyle_empty_config.xml')
def setUp(self): self.section = Section("test section") self.uut = CheckstyleBear.CheckstyleBear(self.section, Queue()) test_files = os.path.join(os.path.dirname(__file__), "test_files") self.good_file = os.path.join(test_files, "CheckstyleGood.java") self.bad_file = os.path.join(test_files, "CheckstyleBad.java") self.empty_config = os.path.join(test_files, "checkstyle_empty_config.xml")
def known_path_test(monkeypatch): monkeypatch.setattr(CheckstyleBear, 'known_checkstyles', {'such': 'style'}) with NamedTemporaryFile() as coafile, NamedTemporaryFile() as style_file: coafile_path = pathlib.Path(coafile.name) style_path = pathlib.Path(style_file.name) setting = Setting( 'style_path', style_path.name, origin=str(coafile_path)) assert ( CheckstyleBear.known_checkstyle_or_path(setting) == str(style_path) )
def known_path_test(monkeypatch): monkeypatch.setattr(CheckstyleBear, 'known_checkstyles', {'such': 'style'}) with NamedTemporaryFile() as coafile, NamedTemporaryFile() as style_file: coafile_path = pathlib.Path(coafile.name) style_path = pathlib.Path(style_file.name) setting = Setting('style_path', style_path.name, origin=str(coafile_path)) assert (CheckstyleBear.known_checkstyle_or_path(setting) == str( style_path))
def known_checkstyle_test(monkeypatch): monkeypatch.setattr(CheckstyleBear, 'known_checkstyles', {'such': 'style'}) assert CheckstyleBear.known_checkstyle_or_path('such') == 'such'