Skip to content

Commit

Permalink
Merge 65e018a into 8d0de31
Browse files Browse the repository at this point in the history
  • Loading branch information
dickmao committed Oct 17, 2021
2 parents 8d0de31 + 65e018a commit bcad13b
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 90 deletions.
99 changes: 43 additions & 56 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,72 @@
name: Tests

on:
push:
branches:
- master
pull_request:
paths-ignore:
- 'docs/**'
- '**.rst'
- '**.org'
push:
paths-ignore:
- 'docs/**'
- '**.rst'
- '**.org'
branches-ignore:
- 'master'
- 'main'

jobs:
build:
runs-on: ubuntu-latest
# continue-on-error: true
strategy:
fail-fast: false
matrix:
emacs_version:
# - 24.1
# - 24.2
# - 24.3
# - 24.4
# - 24.5
# - 25.1
# - 25.2
# - 25.3
- 26.1
- 26.2
- 26.3
- 27.1
# - snapshot
- 27.2
python_version:
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
steps:
# Checkout
- uses: actions/checkout@v2
# Emacs
- name: Set up Emacs ${{ matrix.emacs_version }}
uses: purcell/setup-emacs@master
- uses: purcell/setup-emacs@master
with:
version: ${{ matrix.emacs_version }}
# Cask
- name: Set up Cask
uses: conao3/setup-cask@master
with:
version: 'snapshot'
# Python
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v2
- uses: actions/setup-python@v2
with:
python-version : ${{ matrix.python_version }}
- name: Install Python dependencies
- uses: actions/cache@v2
id: cache-cask-packages
with:
path: .cask
key: cache-cask-packages-000
- uses: actions/cache@v2
id: cache-cask-executable
with:
path: ~/.cask
key: cache-cask-executable-000
- uses: conao3/setup-cask@master
if: steps.cache-cask-executable.outputs.cache-hit != 'true'
with:
version: snapshot
- run: |
echo "$HOME/.cask/bin" >> $GITHUB_PATH
- name: pip
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt --upgrade
pip install -r requirements-rpc.txt --upgrade
pip install -r requirements-dev.txt --upgrade
if [[ ${{ matrix.python_version }} > 3.5 ]] ; then
pip install -r requirements-rpc3.6.txt --upgrade ;
fi
if [[ ${{ matrix.python_version }} < 3 ]] ; then
pip install -r requirements-dev2.txt --upgrade ;
fi
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install coveralls
python -m virtualenv $HOME/.virtualenvs/elpy-test-venv
# Run tests
- name: Run Emacs tests
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 5
command: cask install ; PYTHONPATH="`pwd`" cask exec ert-runner --reporter ert+duration
- name: Run Python tests
- name: ert
run: |
cask install
cask exec ert-runner --reporter ert+duration
- name: nose
run: nosetests
# Coveralls
- name: Coveralls
- name: coveralls
if: ${{ matrix.python_version > 3 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ ${{ matrix.python_version }} > 3 ]] ; then
coverage run -m nose.__main__
coveralls --service=github ;
fi
coverage run -m nose.__main__
coveralls --service=github
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ build/
elpy.egg-info/
_build
.cache
elpy-autoloads.el
.vscode
12 changes: 6 additions & 6 deletions Cask
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

(package "elpy" "1.35.0" "Emacs Python Development Environment")

(depends-on "company" "0.9.13")
(depends-on "highlight-indentation" "0.7.0")
(depends-on "pyvenv" "1.21")
(depends-on "yasnippet" "0.14.0")
(depends-on "s" "1.12.0")
(depends-on "company")
(depends-on "highlight-indentation")
(depends-on "pyvenv")
(depends-on "yasnippet")
(depends-on "s")

(development
(depends-on "f")
(depends-on "ert-runner")
(depends-on "find-file-in-project" "6.0.0"))
(depends-on "find-file-in-project"))
6 changes: 3 additions & 3 deletions elpy-rpc.el
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ needed packages from `elpy-rpc--get-package-list'."
(defun elpy-rpc--get-package-list ()
"Return the list of packages to be installed in the RPC virtualenv."
(let ((rpc-python-version (elpy-rpc--get-python-version)))
(if (version< rpc-python-version "3.6.0")
'("jedi" "flake8" "autopep8" "yapf")
'("jedi" "flake8" "autopep8" "yapf" "black"))))
(append '("jedi" "flake8" "autopep8" "yapf")
(unless (version< rpc-python-version "3.6.0")
'("black")))))

(defun elpy-rpc--get-python-version ()
"Return the RPC python version."
Expand Down
16 changes: 8 additions & 8 deletions elpy-shell.el
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,14 @@ shell (often \"*Python*\" shell)."
If the shell is not running, waits until the first prompt is visible and
commands can be sent to the shell."
(with-current-buffer (process-buffer (elpy-shell-get-or-create-process))
(let ((cumtime 0))
(while (and (when (boundp 'python-shell--first-prompt-received)
(not python-shell--first-prompt-received))
(< cumtime 3))
(sleep-for 0.1)
(setq cumtime (+ cumtime 0.1)))))
(elpy-shell-get-or-create-process))
(let ((process (elpy-shell-get-or-create-process)))
(prog1 process
(with-current-buffer (process-buffer process)
(let ((cumtime 0))
(when (boundp 'python-shell--first-prompt-received)
(cl-loop until python-shell--first-prompt-received
repeat 100
do (accept-process-output nil 0.1))))))))

(defun elpy-shell--string-without-indentation (string)
"Return the current string, but without indentation."
Expand Down
1 change: 0 additions & 1 deletion elpy/auto_pep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from elpy.rpc import Fault
import os


try:
import autopep8
except ImportError: # pragma: no cover
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
unittest2; python_version < '3'
bumpversion
coverage
mock
Expand Down
1 change: 0 additions & 1 deletion requirements-dev2.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements-rpc.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements-rpc3.6.txt

This file was deleted.

5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
jedi
autopep8
yapf
setuptools
flake8
black; python_version >= '3.6'
1 change: 0 additions & 1 deletion test/elpy-autopep8-fix-code-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"x = 1"
"y = 2_|_"
)

(elpy-autopep8-fix-code)
(should
(buffer-be
Expand Down
17 changes: 8 additions & 9 deletions test/test-helper.el
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,14 @@ itself a list where the car indicates the type of environment.
names, possibly including directory names."
(declare (indent 1))
`(save-buffer-excursion
(when elpy-enabled-p
(message "Elpy was not deactivated by the previous test, deactivating...")
(elpy-disable))
(with-temp-buffer
(setq elpy-rpc-timeout 100)
,(elpy-testcase-transform-spec spec body))
(when (and (boundp 'elpy-enabled-p)
elpy-enabled-p)
(elpy-disable))))
(with-temp-buffer
(elpy-disable)
(let ((elpy-rpc-timeout 100)
(elpy-rpc-maximum-buffer-age 10000))
(unwind-protect
(progn
,(elpy-testcase-transform-spec spec body))
(elpy-disable))))))

(defun elpy-testcase-create-files (basedir filespec)
"In BASEDIR, create files according to FILESPEC.
Expand Down

0 comments on commit bcad13b

Please sign in to comment.