Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automated CI tests for the GAP.prompt() #460

Closed
fingolfin opened this issue May 18, 2020 · 4 comments · Fixed by #1106
Closed

Add automated CI tests for the GAP.prompt() #460

fingolfin opened this issue May 18, 2020 · 4 comments · Fixed by #1106
Labels
help wanted Extra attention is needed kind: enhancement New feature or request topic: tests CI coverage
Milestone

Comments

@fingolfin
Copy link
Member

Right now I am not aware of a "good" way to test GAP.prompt(); but I'd really like to have one, so that when an issue like #458 pops up, then the fix (here in #459) can also include a test that verifies the issue is gone.

One way to go about this might be to use pexpect which can be used to automate interactive command line utilities. (Of course if somebody knows a pure-Julia way to do the same, I'd also be happy to use that). This can also be handy for other kinds of tests, as it allows to emulate what an actual user would experience very closely.

I think we need to do roughly this:

  1. add pip install pexpect into .travis.yml
  2. add a script to etc which performs the required test using pexpect
  3. call that script from .travis.yml
@fingolfin
Copy link
Member Author

Perhaps testing the Help system might also benefit from such a thing? @ThomasBreuer ?

@fingolfin fingolfin added kind: enhancement New feature or request topic: tests CI coverage help wanted Extra attention is needed labels Dec 11, 2020
@fingolfin
Copy link
Member Author

Sp perhaps we should just use the Python package pexpect, it's not like it is hard; a simple attempt:

>>> import pexpect
>>> child = pexpect.spawn('julia-1.5 --project=proj-1.5')
>>> child.expect('julia> ')
0
>>> child.sendline('using GAP')
10
>>> child.expect('julia> ')
0
>>> child.sendline('GAP.prompt()')
13
>>> child.expect('gap> ')
0
>>> child.sendline('1+1;')
5
>>> child.expect('gap> ')
0
>>> child.sendline('1:1;')
5
>>> child.expect('gap> ')
0
>>> child.sendline('Error("foo");')
14
>>> child.expect('brk> ')
0
>>> child.sendline('quit;')
6
>>> child.sendline('quit;')
6
>>> child.expect('julia> ')
0

@ThomasBreuer
Copy link
Member

Not only the help system, there are also other interactive features like Julia's REPL menus which can be tested then.

@fingolfin
Copy link
Member Author

Just learned about https://gitlab.com/wavexx/Expect.jl which we can use for this, too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed kind: enhancement New feature or request topic: tests CI coverage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants