Merge remote-tracking branch 'refs/remotes/origin/38-fixing-testing' into 104-load-magic

This commit is contained in:
John Miller 2016-12-18 19:30:06 -06:00
commit 1e56d388de
6 changed files with 58 additions and 21 deletions

1
.gitignore vendored
View file

@ -1,6 +1,5 @@
doc/build/
env
log
.gitmodules
*.stackdump
*.elc

View file

@ -1,24 +1,30 @@
language: python
addons:
apt:
packages:
- git
matrix:
fast_finish: true
allow_failures:
- env: EMACS_VERSION=snapshot
- env: EVM_EMACS=emacs-git-snapshot
python:
- "2.7"
- "3.4"
- "3.5"
before_install:
- sudo apt-get -yq update
# Configure $PATH: Executables are installed to $HOME/bin
- export PATH="$HOME/bin:$PATH"
# Download the makefile to emacs-travis.mk
- wget 'https://raw.githubusercontent.com/flycheck/emacs-travis/master/emacs-travis.mk'
# Install Emacs (according to $EMACS_VERSION)
- sudo make -f emacs-travis.mk install_emacs EMACSCONFFLAGS='--with-xml2 CFLAGS=-O2 CXXFLAGS=-O2'
- sudo apt-get -yq install git
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh
- evm install $EVM_EMACS --use --skip
- cask install
- evm list
install:
- pip install jupyter==$JUPYTER
env:
- EMACS_VERSION=24.3 IPYCMD=jupyter JUPYTER=1.0.0
- EMACS_VERSION=25.1-rc2 IPYCMD=jupyter JUPYTER=1.0.0
script: python tools/testein.py --emacs emacs --ipython $IPYCMD
- EVM_EMACS=emacs-24.4-travis IPYCMD=jupyter JUPYTER=1.0.0
- EVM_EMACS=emacs-25.1-travis IPYCMD=jupyter JUPYTER=1.0.0
- EVM_EMACS=emacs-git-snapshot-travis IPYCMD=jupyter JUPYTER=1.0.0
script:
- emacs --version
- python tools/testein.py --emacs emacs --ipython $IPYCMD

12
Cask Normal file
View file

@ -0,0 +1,12 @@
(source gnu)
(source melpa)
(package "ein" "0.12.0" "Emacs IPython Notebook.")
(package-file "lisp/ein.el")
(files ("lisp/*.el" :exclude ("lisp/zeroein.el")))
(development
(depends-on "websocket")
(depends-on "request")
(depends-on "cl-generic")
(depends-on "ecukes"))

1
log/README Normal file
View file

@ -0,0 +1 @@
For testing logs.

View file

@ -3,7 +3,9 @@
;; Usage:
;; emacs -Q -batch -L ... -l tests/test-load.el -f ert-run-tests-batch
;; You will need to set load paths using `-L' switch.
(prefer-coding-system 'utf-8)
(require 'ein-dev)
(require 'ein-testing)

View file

@ -8,11 +8,16 @@ import glob
import os
import sys
import re
from subprocess import Popen, PIPE, STDOUT
from subprocess import Popen, PIPE, STDOUT, check_output
EIN_ROOT = os.path.normpath(
os.path.join(os.path.dirname(__file__), os.path.pardir))
def cask_load_path():
path = check_output(['cask','load-path'])
return path.decode()
def has_library(emacs, library):
"""
Return True when `emacs` has build-in `library`.
@ -176,13 +181,17 @@ class TestRunner(BaseRunner):
command.extend(['-L', path])
for path in self.load:
command.extend(['-l', path])
command.extend(['-L', einlispdir(),
'-L', einlibdir('websocket'),
'-L', einlibdir('request'),
'-L', einlibdir('auto-complete'),
'-L', einlibdir('popup'),
'-L', eintestdir(),
'-l', eintestdir(self.testfile)])
# command.extend(['-L', einlispdir(),
# '-L', einlibdir('websocket'),
# '-L', einlibdir('request'),
# '-L', einlibdir('auto-complete'),
# '-L', einlibdir('popup'),
# '-L', eintestdir(),
# '-l', eintestdir(self.testfile)])
return command
@property
@ -197,7 +206,7 @@ class TestRunner(BaseRunner):
def show_sys_info(self):
print(("*" * 50))
command = self.base_command + [
'-batch', '-l', 'ein-dev', '-f', 'ein:dev-print-sys-info']
'-batch', '-l', 'lisp/ein-dev.el', '-f', 'ein:dev-print-sys-info']
proc = Popen(command, stderr=PIPE)
err = proc.stderr.read()
proc.wait()
@ -223,6 +232,7 @@ class TestRunner(BaseRunner):
def make_process(self):
print("Start test {0}".format(self.testfile))
print("Emacs command {0}".format(self.command))
self.proc = Popen(self.command, stdout=PIPE, stderr=STDOUT)
return self.proc
@ -322,6 +332,9 @@ class ServerRunner(BaseRunner):
@staticmethod
def _parse_port_line(line):
if line.find('token'):
port = line.rpartition('/')[0]
port = line.strip().rsplit(':', 1)[-1].strip('/')
return port
@ -366,7 +379,7 @@ class ServerRunner(BaseRunner):
)
return self.command_template.format(**fmtdata)
command_template = r"""{ipython} notebook --notebook-dir {notebook_dir} --no-browser --debug 2>&1 | tee {server_log} | grep --line-buffered 'Notebook is running at' | head -n1"""
command_template = r"""{ipython} notebook --notebook-dir {notebook_dir} --no-browser --NotebookApp.token='' --debug 2>&1 | tee {server_log} | grep --line-buffered 'Notebook is running at' | head -n1"""
def kill_subprocesses(pid, include=lambda x: True):
@ -429,7 +442,11 @@ def run_ein_test(unit_test, func_test, func_test_max_retries,
def main():
import sys
import os
from argparse import ArgumentParser
os.environ['EMACSLOADPATH'] = cask_load_path()
os.environ['LC_ALL'] = 'en_us.UTF-8'
parser = ArgumentParser(description=__doc__.splitlines()[1])
parser.add_argument('--emacs', '-e', default='emacs',
help='Emacs executable.')
@ -440,14 +457,14 @@ def main():
help="load lisp file before tests. "
"can be specified multiple times.")
parser.add_argument('--load-ert', default=False, action='store_true',
help="load ERT from git submodule. "
help="load ERT from git submodule. "
"you need to update git submodule manually "
"if ert/ directory does not exist yet.")
parser.add_argument('--no-auto-ert', default=True,
dest='auto_ert', action='store_false',
help="load ERT from git submodule. "
"if this Emacs has no build-in ERT module.")
parser.add_argument('--no-batch', '-B', default=True,
parser.add_argument('--batch', '-B', default=True,
dest='batch', action='store_false',
help="start interactive session.")
parser.add_argument('--debug-on-error', '-d', default=False,