Skip to content

Commit

Permalink
Repo maintenance
Browse files Browse the repository at this point in the history
- Remove .coveragerc file (be explicit in pytest commmand)
- Update .travis.yml to contain make commands only (reduce dup)
- Simplify pytest.ini
- Clean up docs/conf.py (mock not used)
- Clean up State
- Specific versions in requirements.txt
- Move tests from protowhat/tests/ to tests/
  • Loading branch information
Filip Schouwenaars committed May 17, 2018
1 parent 9844342 commit b46a290
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 27 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
language: python
python:
- '3.5'
install:
- pip install -e .
- pip install -r requirements.txt

install: make install

script: make test

deploy:
provider: pypi
user: machow
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Controls
.PHONY : commands clean test
.PHONY : commands install clean test
all : commands

## commands : show all commands.
commands :
@grep -h -E '^##' Makefile | sed -e 's/## //g'

install:
pip install -e .
pip install -r requirements.txt

## test : run tests.
test :
pytest --cov=protowhat
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@
[![codecov](https://codecov.io/gh/datacamp/protowhat/branch/master/graph/badge.svg)](https://codecov.io/gh/datacamp/protowhat)
[![PyPI version](https://badge.fury.io/py/protowhat.svg)](https://badge.fury.io/py/protowhat)

`protowhat` is a utility package required by `shellwhat` and `sqlwhat` packages, used for writing Submission Correctness Tests SCTs for interactive Shell and SQL exercises on DataCamp. It contains shared functionality related to SCT syntax, selectors and state manipulation.

- If you are new to teaching on DataCamp, check out https://authoring.datacamp.com.
- If you want to learn what SCTs are and how they work, visit https://authoring.datacamp.com/courses/sct.html.
- For a deep dive in `protowhat`, consult https://protowhat.readthedocs.io.

## Installation

```
pip install protowhat
pip install protowhat # install from pypi
make install # install from source
```

## Testing

From the base directory..

```
pip install -e .
py.test
pytest
```
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# Mock heavy duty pythonwhat dependencies for autodoc
import os
import sys
from unittest import mock

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
9 changes: 1 addition & 8 deletions protowhat/State.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ def __init__(self):

def parse(self, *args, **kwargs): return self.ParseError()

class Dispatcher:
@classmethod
def from_dialect(cls):
# TODO return something with a parse method
return DummyParser()

class State:
def __init__(self,
student_code,
Expand Down Expand Up @@ -46,8 +40,7 @@ def __init__(self,
self._child_params = inspect.signature(State.__init__).parameters

def get_dispatcher(self):
# MCE doesn't always have connection - fallback on postgresql
return Dispatcher.from_dialect()
return DummyParser()

def get_ast_path(self):
rev_checks = filter(lambda x: x['type'] in ['check_field', 'check_node'], reversed(self.history))
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
testpaths = protowhat/tests
testpaths = tests
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest
codecov
pytest-cov
bashlex
pytest==3.5.0
codecov==2.0.15
pytest-cov==2.5.1
bashlex==0.12
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def prepare_state(student_code):
solution_code = "NA", pre_exercise_code = "NA",
solution_ast = "NA", student_ast = "NA",
student_result = [], solution_result = [],
student_conn = None, solution_conn = None,
ast_dispatcher = "NA")
student_conn = None, solution_conn = None)

def test_mc_alone_pass():
state = prepare_state("selected_option = 1")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b46a290

Please sign in to comment.