Skip to content

Commit

Permalink
Merge pull request #20 from qtc-de/develop
Browse files Browse the repository at this point in the history
Prepare v1.10.3 Release
  • Loading branch information
qtc-de authored Jun 7, 2022
2 parents d07d7ed + 0efe278 commit 2dcdcd0
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [1.10.2] - Jun 07, 2022

### Changed

* Improve error handling of the [http_listener plugin](/docs/plugins/#httplistenerplugin)
* Improve error handling for yaml related scan errors
* Fix some bugs in the [tempfile plugin](/docs/plugins/#tempfileplugin)


## [1.10.1] - May 25, 2022

### Changed
Expand Down
4 changes: 2 additions & 2 deletions bin/tricot
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ def main():
try:
raise wrapper.original

except yaml.parser.ParserError as e:
tricot.Logger.print_mixed_yellow('Caught', 'ParserError', 'while parsing the test configuration.', e=True)
except (yaml.parser.ParserError, yaml.scanner.ScannerError) as e:
tricot.Logger.print_mixed_yellow('Caught', type(e).__name__, 'while parsing the test configuration.', e=True)
tricot.Logger.print_mixed_blue('Affected file:', wrapper.path, e=True)
tricot.Logger.print_yellow('Original Error:', e=True)
tricot.Logger.increase_indent()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
url='https://github.com/qtc-de/tricot',
name='tricot',
author='Tobias Neitzel (@qtc_de)',
version='1.10.1',
version='1.10.2',
author_email='',

description='Trivial Command Testser',
Expand Down
2 changes: 1 addition & 1 deletion tricot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
VERSION_MISMATCH = 22

LAST_ERROR = 0
VERSION = '1.10.1'
VERSION = '1.10.2'
20 changes: 11 additions & 9 deletions tricot/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,13 @@ def start_server(self, port: int, directory: str) -> None:
'''
Starts the HTTPListener. Should be run in a separate thread.
'''
handler = functools.partial(HttpListenerPlugin.CustomHandler, directory=directory)
self.server = http.server.HTTPServer(('', port), handler)
self.server.serve_forever()
try:
handler = functools.partial(HttpListenerPlugin.CustomHandler, directory=directory)
self.server = http.server.HTTPServer(('', port), handler)
self.server.serve_forever()

except Exception:
pass

def stop(self) -> None:
'''
Expand Down Expand Up @@ -778,7 +782,7 @@ def __init__(self, *args, **kwargs) -> None:
'''
super().__init__(*args, **kwargs)

self.path = self.param['path']
self.tempfile = self.path.parent.joinpath(self.param['path'])
self.mode = self.param.get('mode', 'w')
self.content = self.param.get('content', '')

Expand All @@ -789,17 +793,15 @@ def run(self) -> None:
'''
Create the temporary file and optionally fill it with content.
'''
with open(self.path, self.mode) as temp_file:
with open(self.tempfile, self.mode) as temp_file:
temp_file.write(self.content)

def stop(self) -> None:
'''
Remove the temporary file.
'''
item = Path(self.path)

if item.is_file():
item.unlink()
if self.tempfile.is_file():
self.tempfile.unlink()


register_plugin("os_command", OsCommandPlugin)
Expand Down
2 changes: 1 addition & 1 deletion tricot/tricot.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ def from_file(filename: str, initial_vars: dict[str, Any] = dict(), runtime_vars
try:
config_dict = yaml.safe_load(f.read())

except yaml.parser.ParserError as e:
except (yaml.parser.ParserError, yaml.scanner.ScannerError) as e:
raise ExceptionWrapper(e, Path(filename))

if '$env' not in initial_vars:
Expand Down

0 comments on commit 2dcdcd0

Please sign in to comment.