-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6234af1
Showing
25 changed files
with
832 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feel free to raise an issue for any of the following: | ||
|
||
* Support request | ||
* Feature request | ||
* Argument | ||
* Bug | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Qualities of an ideal pull request: | ||
|
||
Code changes come with a new story or an amendment to an existing story | ||
in order to exercise the code. | ||
|
||
Commit messages that adhere to the following pattern: | ||
|
||
TYPEOFCOMMIT : Quick explanation of what changed and why. | ||
|
||
Where TYPEOFCOMMIT is one of the following: | ||
|
||
* FEATURE - for new features and accompanying stories. | ||
* BUG - for bugfixes and accompanying stories (or amendments to an existing story). | ||
* DOCS - for changes to README, etc. and non-functional changes to stories. | ||
* MISC - Anything else. | ||
|
||
Ideal code qualities: | ||
|
||
* Loosely coupled | ||
* DRY | ||
* Clear and straightforward is preferable to clever | ||
* Docstrings that explain why rather than what | ||
* Clearly disambiguated Variable/method/class names | ||
* Passes flake8 linting with < 100 character lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Regression | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
regression: | ||
timeout-minutes: 30 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: build | ||
run: | | ||
mkdir -p ~/.ssh/ | ||
touch ~/.ssh/id_rsa | ||
touch ~/.ssh/id_rsa.pub | ||
echo test | podman secret create pypitoken - | ||
./key.sh make | ||
- name: regression | ||
run: | | ||
./key.sh regression |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
hitchskeleton.egg-info/ | ||
.vscode/ | ||
venv/ | ||
|
||
docs/snippets/ | ||
docs/draft/ | ||
docs/src/using/ | ||
|
||
hitchpylibrarytoolkit/ | ||
|
||
*.pyc |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 pixegami | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include VERSION | ||
include LICENSE.txt | ||
include README.md | ||
recursive-include hitch * | ||
prune hitch/__pycache__ | ||
prune hitch/gen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hitchskeleton |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.1.0 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{{{ intro.txt }}}} | ||
|
||
HitchSkeleton is a command line bootstrapper for quickly setting up a skeleton | ||
integration testing framework with necessary functionality and sensible defaults | ||
for various different kinds of projects. | ||
|
||
* Realistic | ||
* Hermetic | ||
* Economic | ||
* Literate | ||
|
||
## Quickstart | ||
|
||
{{{{ quickstart.txt }}}} | ||
|
||
## Install | ||
|
||
HitchSkeleton is best install with pipx: | ||
|
||
```bash | ||
pipx install hitchskeleton | ||
``` | ||
|
||
As a command line app, it is typically best installed via | ||
[pipx](https://pypa.github.io/pipx/). | ||
|
||
```bash | ||
pipx install hitchskeleton | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV LC_ALL=C.UTF-8 | ||
ENV LANG=C.UTF-8 | ||
|
||
RUN apt-get update && apt-get install \ | ||
libuv1-dev libncurses5-dev libncursesw5-dev xz-utils \ | ||
liblzma-dev tk-dev build-essential \ | ||
libreadline-dev libffi-dev libsqlite3-dev \ | ||
zlib1g-dev zlib1g libbz2-dev libssl-dev \ | ||
curl git make llvm wget \ | ||
python3-virtualenv virtualenv python3.8-venv \ | ||
python3-dev python-openssl -y \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir /src | ||
WORKDIR /src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
flake8 | ||
ipython #==1.2.1 | ||
pyzmq | ||
path.py | ||
q | ||
ipykernel | ||
sure | ||
ensure | ||
python-slugify | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
from hitchstory import ( | ||
StoryCollection, | ||
BaseEngine, | ||
exceptions, | ||
validate, | ||
no_stacktrace_for, | ||
strings_match, | ||
Failure | ||
) | ||
from hitchstory import GivenDefinition, GivenProperty, InfoDefinition, InfoProperty | ||
from templex import Templex | ||
from strictyaml import Optional, Str, Map, Int, Bool, Enum, load, MapPattern | ||
from path import Path | ||
import hitchpylibrarytoolkit | ||
from hitchrunpy import ( | ||
ExamplePythonCode, | ||
HitchRunPyException, | ||
ExpectedExceptionMessageWasDifferent, | ||
) | ||
from shlex import split | ||
from templex import Templex | ||
from commandlib import Command | ||
|
||
|
||
class Engine(BaseEngine): | ||
"""Python engine for running tests.""" | ||
|
||
given_definition = GivenDefinition( | ||
files=GivenProperty( | ||
MapPattern(Str(), Str()), | ||
inherit_via=GivenProperty.OVERRIDE, | ||
), | ||
) | ||
|
||
info_definition = InfoDefinition( | ||
status=InfoProperty(schema=Enum(["experimental", "stable"])), | ||
docs=InfoProperty(schema=Str()), | ||
) | ||
|
||
def __init__(self, keypath, python_path=None, rewrite=False, cprofile=False): | ||
self.path = keypath | ||
self._python_path = python_path | ||
self._rewrite = rewrite | ||
self._cprofile = cprofile | ||
|
||
def set_up(self): | ||
"""Set up your applications and the test environment.""" | ||
self.path.profile = self.path.gen.joinpath("profile") | ||
self.path.working = self.path.gen.joinpath("working") | ||
|
||
if self.path.working.exists(): | ||
self.path.working.rmtree() | ||
self.path.working.mkdir() | ||
|
||
for filename, contents in self.given["files"].items(): | ||
filepath = self.path.working.joinpath(filename) | ||
if not filepath.dirname().exists(): | ||
filepath.dirname().mkdir() | ||
self.path.working.joinpath(filename).write_text(contents) | ||
|
||
if not self.path.profile.exists(): | ||
self.path.profile.mkdir() | ||
|
||
self.python = Command(self._python_path) | ||
self.hitchskeleton_bin = Command(self._python_path.parent / "hitchskeleton")\ | ||
.with_env(MOCK="yes") | ||
|
||
@no_stacktrace_for(AssertionError) | ||
@validate(cmd=Str(), output=Str(), error=Bool()) | ||
def hitchskeleton(self, cmd, output, error=False): | ||
command = self.hitchskeleton_bin(*split(cmd)).in_dir(self.path.working) | ||
|
||
if error: | ||
command = command.ignore_errors() | ||
|
||
actual_output = command.output() | ||
|
||
try: | ||
strings_match(output, actual_output) | ||
except Failure: | ||
if self._rewrite: | ||
self.current_step.update(output=actual_output) | ||
else: | ||
raise | ||
|
||
def pause(self, message="Pause"): | ||
import IPython | ||
|
||
IPython.embed() | ||
|
||
def on_success(self): | ||
if self._rewrite: | ||
self.new_story.save() | ||
if self._cprofile: | ||
self.python( | ||
self.path.key.joinpath("printstats.py"), | ||
self.path.profile.joinpath("{0}.dat".format(self.story.slug)), | ||
).run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hitchpylibrarytoolkit==0.6.20 |
Oops, something went wrong.