Skip to content

Commit

Permalink
slightly different approach to test venv build for travis
Browse files Browse the repository at this point in the history
  • Loading branch information
hjwp committed Nov 20, 2019
1 parent e64e56f commit f8d9a1a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ language: python
python: 3.8
install:
- gem install asciidoctor coderay
- pip3 install -r requirements.txt
- pip install -r requirements.txt
script:
- make html update-code test
- make html update-code code-venv test
git:
submodules: false
before_install:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ update-code:
cd code && git fetch
./checkout-branches-for-ci.py

code-venv:
cd code && python3.8 -m venv .venv

count-todos:
ls *.asciidoc | xargs grep -c TODO | sed s/:/\\t/

Expand Down
6 changes: 3 additions & 3 deletions checkout-branches-for-ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
cwd = Path(__file__).parent / 'code'

for chap in CHAPTERS + STANDALONE:
subprocess.run(['git', 'checkout', chap], cwd=cwd)
subprocess.run(['git', 'checkout', chap], cwd=cwd, check=True)
if chap in NO_EXERCISE:
continue
subprocess.run(['git', 'checkout', f'{chap}_exercise'], cwd=cwd)
subprocess.run(['git', 'checkout', f'{chap}_exercise'], cwd=cwd, check=True)

subprocess.run(['git', 'checkout', 'master'], cwd=cwd)
subprocess.run(['git', 'checkout', 'master'], cwd=cwd, check=True)
5 changes: 1 addition & 4 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,9 @@ def tree_for_branch(chapter_name):
def code_venv():
code = Path(__file__).parent / 'code'
venv = code / '.venv'
if (venv / 'bin/pytest').exists():
return
subprocess.run(['python3.8', '-m', 'venv', venv], check=True)
assert (venv / 'bin/pip').exists()
subprocess.run([venv / 'bin/pip', 'install', '-r', code / 'requirements.txt'], check=True)
subprocess.run([venv / 'bin/pip', 'install', '-e', code / 'src'])
subprocess.run([venv / 'bin/pip', 'install', '-e', code / 'src'], check=True)


@pytest.mark.usefixtures('code_venv')
Expand Down

0 comments on commit f8d9a1a

Please sign in to comment.