Comments (6)
accordingly to my test, https://travis-ci.org/Microalg/Microalg/builds/24602682 I would suspect that you've omitted a few key:
world.output += world.process.after.rstrip('\n')
as you can see, the text you are seeking, is actually available in world.after at the time of the exception. What do you think?
I'm glad the # comments and variable_names were english, I understand just enough to know it looks interesting :-) good luck
from pexpect.
abusing your pull to get your travis to display a few more details
You are welcome!!!
accordingly to my test, https://travis-ci.org/Microalg/Microalg/builds/24602682
I would suspect that you've omitted a few key:
world.output += world.process.after.rstrip('\n')
Not sure. This doesn't explain why it works on my machine but nothing appears on Travis.
as you can see, the text you are seeking, is actually available in
world.after
at the time of the exception. What do you think?
Mmmh. I can only see after: <class 'pexpect.EOF'>
.
I'm glad the # comments and variable_names were english,
I understand just enough to know it looks interesting :-) good luck
Good practice always pay!
This project only targets French people, but I thought this CLI Lettuce steps would be generic enough to be reusable. Hence the # comments and variable_names for a possible publication.
Did you fork+clone on a local machine or just tweaked my files online?
I'm curious to see if it works for you locally...
from pexpect.
Hey @Grahack I'll absolutely look at this again this weekend, any updates (theories?) since last spoke? I'll reproduce locally with mac and linux and see what I think.
from pexpect.
Thanks for considering this issue.
Things are worse and better:
- worse since things now go wrong on my machine too,
- better because its easier to test locally and not on Travis ;)
My theory is that it is a flush issue.
I wrote some install docs here for you since the only docs I have are in French.
Sorry, this is quite big, but only needed once. For a minimal one, see at the bottom of this post.
For the big one:
- clone
- my project is a language embedded in a Lisp called PicoLisp, so you have to install two versions of Picolisp (run the two install scripts, or adapt content)
- the main one (C/ASM), a C toolchain is needed for the installation
- a Java version called Ersatz, only
java
is needed (and notjavac
since a.jar
is provided) to run it
- NodeJS is needed too since a third implementation of PicoLisp is Node-based, the node module is in the repo.
- see
.travis.yml
for some other requirements (includingpexpect
!) - from the root of the clone, PATH=$PATH:
pwd
:pwd
/picolisp:pwd
/ersatz:pwd
/emulisp
Now you can lettuce
or lettuce -v 2
… and see the fails.
One suggestion I have is to run the failing examples and see that in fact they work well:
- run by hand, like
pil exemples/test_read.l
ormalgjs exemples/test_demander.malg
- run with
pexpect
interactively, like:
>>> import pexpect
>>> child = pexpect.spawn('pil', ['exemples/test_read.l'])
>>> child.expect('.*')
0
>>> child.after
"Votre nom ?"\r\n'
>>> child.sendline('jquast')
7
>>> child.expect('.*')
0
>>> child.after
jquast\r\n"Salut jquast"\r\n'
>>> child.expect(pexpect.EOF) # Strange: I call child.expect('.*') in the original script.
0
>>>
Minimal setup:
- clone
- install lettuce, fix lettuce (see the script
fix_lettuce.sh
) - install pexpect (ya know, this interesting project I once told you about ;)
- install nodejs and the sync-prompt module (if possible, I know it's hard on Windows)
lettuce -v 2 -s 6 features/hello.feature
to see it fail with pexpect- see it work too:
- by hand: run
malgjs exemple/test_demander.malg
to see it work by hand - in the Python prompt, as above, to see it work with pexpect
- by hand: run
from pexpect.
I'm very sure this is due to greedy ".*"
search. You are in a race, processes and buffers are racing at different speeds, ".*"
is simply too greedy. You need to expect newlines, if "for each line input, expect each line output" is desired. Expecting ".*"
might match well.. nothing !
>>> bool(re.search(pattern=".*", string=""))
True
I think I can submit a patch to your cli.py, we will see.
from pexpect.
I was not able to get the nodejs version (can't find it using npm), nor the java version (its not clear how it is installed, it certainly is called 'pilj' on my system) of picolisp installed correctly.
regardless i submitted pull to your project https://github.com/jquast/Microalg/commit/b8215fa11fa344c21a4c5d98ee516ebbdda8b1ab
the root of the issue is your expecting of .*
, i'm very certain of it. Where your tests fail, if you simply display the world.process object, you will see the data you desire in world.process.after, not world.process.before, because your expect will match anything, even nothing.
I recommend you work around the concept of a repl, with a PROMPT. picolisp has one, and you can expect \r\n :
-- unfortunately one of your test cases overrides that with its own custom prompt, so I can't really recommend it in bin/cli.py except for some kind of parameter.
maybe even look into @takluyver work in adding a "replwrapper" #51
from pexpect.
Related Issues (20)
- Support for new release HOT 3
- Two tests hang on `cat` HOT 3
- test_large_stdout_stream timeout HOT 1
- REPLWrapTestCase.test_existing_spawn fail on illumos HOT 1
- sdist is missing requirements-testing.txt
- AttributeError: module 'asyncio' has no attribute 'coroutine' HOT 1
- Incorrect DEVELOPERS.rst
- False positive expect_exact HOT 1
- Test REPLWrapTestCase.test_pager_as_cat fails.
- An asterisk appearing out of nowhere with Clojure
- Time for a release: any reason to delay? HOT 5
- 4.9.0: git tag does not match PyPI version HOT 2
- Handling SIGTSTP possible?
- Docs not updated for 4.9?
- 4.9: pytest fails in 3 units HOT 1
- "expect()" and "await expect()" have different results on completed processes
- Pexpect does not implement enough asynchronous methods to prevent the use of time.sleep().
- add contribution documentation
- Pxssh sometime does not capture the full output of previous `sendline`
- trouble using pexpect with julia
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pexpect.