icontract-hypothesis-vscodeIcontract-hypothesis-vscode is an extension for Visual Studio Code (VS Code) that allows you to automatically test your Python code using icontract-hypothesis. InstallationIcontract-hypothesis-vscode has two dependencies:
ms-python.python. Use the Visual Studio marketplace to install the extension ms-python.python by following this link. icontract-hypothesis. The easiest way to install the package icontract-hypothesis is via pip3:
If you use a virtual environment, make sure that you activate it beforehand so that the package icontract-hypothesis is installed in it (instead of globally). You have to set up ms-python.python extension so that icontract-hypothesis-vscode can use the package icontract-hypothesis. icontract-hypothesis-vscode. Use the Visual Studio marketplace to install the extension ms-python.python by following this link. UsageThe icontract-hypothesis-vscode is automatically activated when you start your VS Code. You access it through the editor context pop-up menu: Once you click on it, a quick pick will appear so that you can choose one of the possible commands: If your file contains unsaved changes, the file will be saved first before the commands are executed. The commands are executed in a terminal named "icontract-hypothesis". (If a terminal with that name already exists, it will be closed first and then freshly re-opened. This is necessary so that we do not pollute your terminal space on many command calls.) The following commands are provided: test. Infer the Hypothesis strategies for all the global functions in the active file and execute them. test at. Infer the Hypothesis strategy for the global function at the caret. If the caret is outside of a function, this command does nothing. inspect. Infer the Hypothesis strategies for all the global functions in the active file and write them to the standard output so that you can inspect what will be eventually executed. inspect at. Analogous to "test at", this command lets you inspect the inferred Hypothesis strategies for the global function at the caret. If the caret is outside of a function, this command does nothing. ghostwrite explicit. Infer the Hypothesis strategies for all the global functions in the active file. Then generate a stub unit test file with the strategies explicitly written out and print the test file to the standard output. ghostwrite explicit to. Same as "ghostwrite explicit", but saves the generated test file to a file on disk. CommandsThe extension defines the following commands:
Please see Section "Usage" for more details. Known IssuesIt is hard to control terminals in VS Code (see this issue). We wait for a short delay (~1 second) till we send commands to the terminal. This might cause racing conditions in some rare cases. VersioningWe follow a bit unusual semantic versioning schema:
Release Notes1.1.0Refactor actions into individual commands (#4) 1.0.1Fix URL of the images in the Readme (#2) 1.0.0Initial release of icontract-hypothesis-vscode. |