hitchdev / hitchstory Goto Github PK
View Code? Open in Web Editor NEWType-safe YAML integration tests. Tests that write your docs. Tests that rewrite themselves.
Home Page: https://hitchdev.com/hitchstory
License: Other
Type-safe YAML integration tests. Tests that write your docs. Tests that rewrite themselves.
Home Page: https://hitchdev.com/hitchstory
License: Other
I have installed hitchkey with pip install -U hitchkey
directly before trying to run tests and I am trying both commands on the current strictyaml
master.
❯ pip show hitchkey
Name: hitchkey
Version: 0.6.1
Summary: HitchKey bootstrapper - set up a development environment.
Home-page: https://hitchtest.readthedocs.org/
Author: Colm O'Connor
Author-email: [email protected]
License: AGPL
Location: /home/daniel/.local/lib/python3.9/site-packages
Requires:
Required-by:
❯ hk regression
CommandError
Can't create CommandPath object: /home/daniel/.hitch/0phcf6/py3.7.0/bin does not exist.
RUNNING A YAMLError will be raised if there are syntactic problems, violations of your schema or use of disallowed YAML features/For example, a schema violation in /home/daniel/projects/strictyaml/hitch/story/quickstart.story ... Downloading Python-2.7.14.tar.xz...
-> https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz
Installing Python-2.7.14...
BUILD FAILED (Arch rolling using python-build 20180424)
Inspect or clean up the working tree at /tmp/python-build.20210814125339.59626
Results logged to /tmp/python-build.20210814125339.59626.log
Last 10 log lines:
/usr/bin/ld: libpython2.7.a(posixmodule.o): in function `posix_tempnam':
/tmp/python-build.20210814125339.59626/Python-2.7.14/./Modules/posixmodule.c:7589: warning: the use of `tempnam' is dangerous, better use `mkstemp'
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
generate-posix-vars failed
make: *** [Makefile:514: pybuilddir.txt] Error 1
FAILED in 27.5 seconds.
[1]: function 'set_up'
/home/daniel/projects/strictyaml/hitch/engine.py
70 : ).with_python_version(self.given["python version"])\
71 : .with_packages({"ruamel.yaml": self.given["ruamel version"]})
--> 72 : self.pylibrary.ensure_built()
73 : self.python = self.pylibrary.bin.python
[2]: function 'ensure_built'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuild/build.py
249 : def ensure_built(self):
250 : with BuildContextManager(self):
--> 251 : self.build()
252 :
[3]: function 'build'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchpylibrarytoolkit/build.py
56 : def build(self):
57 : pipinstalle = self.virtualenv.incomplete()
--> 58 : self.virtualenv.ensure_built()
59 : if pipinstalle:
[4]: function 'ensure_built'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuild/build.py
249 : def ensure_built(self):
250 : with BuildContextManager(self):
--> 251 : self.build()
252 :
[5]: function 'build'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuildpy/virtualenv.py
39 : self.build_path.rmtree(ignore_errors=True)
40 : self.build_path.mkdir()
--> 41 : self.base_python.build.ensure_built()
42 : self.base_python.build.bin.virtualenv(self.build_path).run()
[6]: function 'ensure_built'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuild/build.py
249 : def ensure_built(self):
250 : with BuildContextManager(self):
--> 251 : self.build()
252 :
[7]: function 'build'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuildpy/pyenv.py
22 : self.build_path.mkdir()
23 :
--> 24 : Command(
25 : Path(__file__).dirname().abspath().joinpath("bin", "python-build")
[8]: function 'run'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/commandlib/command.py
234 :
235 : if returncode != 0 and not self._ignore_errors:
--> 236 : raise CommandError('"{0}" failed (err code {1})'.format(
237 : self.__repr__(),
commandlib.exceptions.CommandError
commandlib exception.
"/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuildpy/bin/python-build 2.7.14 /home/daniel/.hitch/share/python2.7.14" failed (err code 1)
RUNNING A YAMLError will be raised if there are syntactic problems, violations of your schema or use of disallowed YAML features/For example, a schema violation in /home/daniel/projects/strictyaml/hitch/story/quickstart.story ... Downloading Python-2.7.14.tar.xz...
-> https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz
Installing Python-2.7.14...
BUILD FAILED (Arch rolling using python-build 20180424)
Inspect or clean up the working tree at /tmp/python-build.20210814125407.66268
Results logged to /tmp/python-build.20210814125407.66268.log
Last 10 log lines:
/usr/bin/ld: libpython2.7.a(posixmodule.o): in function `posix_tempnam':
/tmp/python-build.20210814125407.66268/Python-2.7.14/./Modules/posixmodule.c:7589: warning: the use of `tempnam' is dangerous, better use `mkstemp'
./python -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
generate-posix-vars failed
make: *** [Makefile:514: pybuilddir.txt] Error 1
FAILED in 27.6 seconds.
[1]: function 'set_up'
/home/daniel/projects/strictyaml/hitch/engine.py
70 : ).with_python_version(self.given["python version"])\
71 : .with_packages({"ruamel.yaml": self.given["ruamel version"]})
--> 72 : self.pylibrary.ensure_built()
73 : self.python = self.pylibrary.bin.python
[2]: function 'ensure_built'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuild/build.py
249 : def ensure_built(self):
250 : with BuildContextManager(self):
--> 251 : self.build()
252 :
[3]: function 'build'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchpylibrarytoolkit/build.py
56 : def build(self):
57 : pipinstalle = self.virtualenv.incomplete()
--> 58 : self.virtualenv.ensure_built()
59 : if pipinstalle:
[4]: function 'ensure_built'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuild/build.py
249 : def ensure_built(self):
250 : with BuildContextManager(self):
--> 251 : self.build()
252 :
[5]: function 'build'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuildpy/virtualenv.py
39 : self.build_path.rmtree(ignore_errors=True)
40 : self.build_path.mkdir()
--> 41 : self.base_python.build.ensure_built()
42 : self.base_python.build.bin.virtualenv(self.build_path).run()
[6]: function 'ensure_built'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuild/build.py
249 : def ensure_built(self):
250 : with BuildContextManager(self):
--> 251 : self.build()
252 :
[7]: function 'build'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuildpy/pyenv.py
22 : self.build_path.mkdir()
23 :
--> 24 : Command(
25 : Path(__file__).dirname().abspath().joinpath("bin", "python-build")
[8]: function 'run'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/commandlib/command.py
234 :
235 : if returncode != 0 and not self._ignore_errors:
--> 236 : raise CommandError('"{0}" failed (err code {1})'.format(
237 : self.__repr__(),
commandlib.exceptions.CommandError
commandlib exception.
"/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuildpy/bin/python-build 2.7.14 /home/daniel/.hitch/share/python2.7.14" failed (err code 1)
❯ hk bdd dirty
RUNNING Dirty load/Flow style mapping in /home/daniel/projects/strictyaml/hitch/story/dirty-load.story ... Downloading Python-3.7.0.tar.xz...
-> https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
Installing Python-3.7.0...
Installed Python-3.7.0 to /home/daniel/.hitch/share/python3.7.0
FAILED in 108.9 seconds.
[1]: function 'set_up'
/home/daniel/projects/strictyaml/hitch/engine.py
70 : ).with_python_version(self.given["python version"])\
71 : .with_packages({"ruamel.yaml": self.given["ruamel version"]})
--> 72 : self.pylibrary.ensure_built()
73 : self.python = self.pylibrary.bin.python
[2]: function 'ensure_built'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuild/build.py
249 : def ensure_built(self):
250 : with BuildContextManager(self):
--> 251 : self.build()
252 :
[3]: function 'build'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchpylibrarytoolkit/build.py
56 : def build(self):
57 : pipinstalle = self.virtualenv.incomplete()
--> 58 : self.virtualenv.ensure_built()
59 : if pipinstalle:
[4]: function 'ensure_built'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuild/build.py
249 : def ensure_built(self):
250 : with BuildContextManager(self):
--> 251 : self.build()
252 :
[5]: function 'build'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuildpy/virtualenv.py
39 : self.build_path.rmtree(ignore_errors=True)
40 : self.build_path.mkdir()
--> 41 : self.base_python.build.ensure_built()
42 : self.base_python.build.bin.virtualenv(self.build_path).run()
[6]: function 'ensure_built'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuild/build.py
249 : def ensure_built(self):
250 : with BuildContextManager(self):
--> 251 : self.build()
252 :
[7]: function 'build'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/hitchbuildpy/pyenv.py
30 : self.bin.easy_install("--upgrade", "pip").run()
31 : else:
--> 32 : self.bin.pip("install", "pip", "--upgrade").run()
33 : self.bin.pip("install", "virtualenv", "--upgrade")\
[8]: function 'run'
/home/daniel/.hitch/0phcf6/hvenv/lib/python3.9/site-packages/commandlib/command.py
234 :
235 : if returncode != 0 and not self._ignore_errors:
--> 236 : raise CommandError('"{0}" failed (err code {1})'.format(
237 : self.__repr__(),
commandlib.exceptions.CommandError
commandlib exception.
"/home/daniel/.hitch/share/python3.7.0/bin/pip install pip --upgrade" failed (err code -11)
It looks like it is trying to install a specific python version and is failing... Is there a way to tell it to use the system python version?
Hi @crdoconnor
I'm thinking of using hitchstory for another project (remember we met at Babylon).
I was going to run through the tests and check everything was working with Python 3.9 (maybe 3.10). What's the best way for me to get setup for contributing? Happy to write this up in a contributing guide.
Cheers!
I'm testing some Django code, and I'd like to use the Django test client. This is available in Pytest via pytest-django
providing a client fixture.
It's meant to be used like this:
def test_with_client(client):
response = client.get('/')
assert response.content == 'Foobar'
I think the most natural way to adapt this to the Hitchstory approach is to add the decorator to my test_foo
Pytest function:
def test_foobar(client):
hs.named("Something with a client").play()
but it's not obvious there's a clean way to pass the client object through so that the engine can get at it. I think the client is recreated with each test (it potentially holds state) so we don't want to create the client once and include it when instantiating the engine.
Hi,
I've recently discovered hitchstory and been trying to get the rewrite test_correct_my_spelling example working.
The issue I'm currently seeing is that when running $ STORYMODE=rewrite ./run.sh pytest -k test_correct_my_spelling
I'm getting the error No such file or directory: '/src/tests/docstory.yml
.
I'm wondering if this is to do with the recent directory changes?
It appears a lot of the links on that example page are also broken as a result of the directoy changes.
Or is there something I'm doing wrong?
Thanks
Hi there hitchdev!
I found no better place to send in the following pedantry, so here it goes:
As of today (2023-02-25), the webpage https://hitchdev.com/strictyaml/why/implicit-typing-removed/ demonstrates the "The Norway Problem", where the YAML specification directs the parsing of values (without surrounding quotes) like GB
, IE
, FR
, and DE
into strings, but to the surprise of many users mandates parsing the value (again without surrounding quotes) NO
, the two letter code for Norway, as boolean false
.
Further down, also the following statement is made:
The most tragic aspect of this bug, however, is that it is intended behavior according to the YAML 1.2 specification.
Where the last part of the sentence is a hyperlink to https://yaml.org/spec/1.2.2/
However,
for the 1.2.2 specification, i could not find the paragraph where the string "NO" is a valid format of the boolean true
.
The 1.2.2 changelog of the specification (link here: https://yaml.org/spec/1.2.2/ext/changes/ ) explicitely lists the change, that starting with the revision 1.2.0 (2009-07-21):
Only true and false strings are parsed as booleans (including True and TRUE); y, yes, on, and their negative counterparts are parsed as strings.
Notwithstanding all the other aspects of YAML that justify StrictYaml to refuse to parse certain features of YAML, this particular statement on the homepage, that NO
(without quotes) shall be parsed into a boolean false
when pedanticly following the 1.2.2 revision of the YAML-Spec is not true.
I would suggest that
best regards,
Max
[*] which means that some valid yaml documents are parsed differently with a yaml-1.1 parser and a yaml-1.2 parser, and this demonstrates another aspect of the YAML spec to be on the lookout for.
I think the wiki link should take me to the wiki, or wiki should be disabled so it doesn't show in the tab list for the project.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.