-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
106 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# A GNU Makefile to run various tasks - compatibility for us old-timers. | ||
|
||
# Note: This makefile include remake-style target comments. | ||
# These comments before the targets start with #: | ||
# remake --tasks to shows the targets and the comments | ||
|
||
GIT2CL ?= admin-tools/git2cl | ||
PYTHON ?= python | ||
PIP ?= $(PYTHON) -m pip | ||
RM ?= rm | ||
|
||
|
||
.PHONY: all build \ | ||
check clean \ | ||
develop dist doc doc-data \ | ||
pypi-setup \ | ||
pytest \ | ||
rmChangeLog \ | ||
test | ||
|
||
#: Default target - same as "develop" | ||
all: develop | ||
|
||
#: build everything needed to install | ||
build: pypi-setup | ||
$(PYTHON) ./setup.py build | ||
|
||
#: Check Python version, and install PyPI dependencies | ||
pypi-setup: | ||
$(PIP) install -e . | ||
|
||
#: Set up to run from the source tree | ||
develop: pypi-setup | ||
|
||
#: Make distirbution: wheels, eggs, tarball | ||
dist: | ||
./admin-tools/make-dist.sh | ||
|
||
#: Install pymathics.graph | ||
install: pypi-setup | ||
$(PYTHON) setup.py install | ||
|
||
# Run tests | ||
test check: pytest doctest | ||
|
||
#: Remove derived files | ||
clean: clean-pyc | ||
|
||
#: Remove old PYC files | ||
clean-pyc: | ||
@find . -name "*.pyc" -type f -delete | ||
|
||
#: Run py.test tests. Use environment variable "o" for pytest options | ||
pytest: | ||
MATHICS_CHARACTER_ENCODING="ASCII" $(PYTHON) -m pytest $(PYTEST_WORKERS) test $o | ||
|
||
|
||
# #: Create data that is used to in Django docs and to build TeX PDF | ||
# doc-data mathics/doc/tex/data: mathics/builtin/*.py mathics/doc/documentation/*.mdoc mathics/doc/documentation/images/* | ||
# $(PYTHON) mathics/test.py -ot -k | ||
|
||
#: Run tests that appear in docstring in the code. | ||
doctest: | ||
MATHICS_CHARACTER_ENCODING="ASCII" $(PYTHON) -m mathics.docpipeline -l pymathics.language -c "Pymathics Language" $o | ||
|
||
# #: Make Mathics PDF manual | ||
# doc mathics.pdf: mathics/doc/tex/data | ||
# (cd mathics/doc/tex && $(MAKE) mathics.pdf) | ||
|
||
#: Remove ChangeLog | ||
rmChangeLog: | ||
$(RM) ChangeLog || true | ||
|
||
#: Create a ChangeLog from git via git log and git2cl | ||
ChangeLog: rmChangeLog | ||
git log --pretty --numstat --summary | $(GIT2CL) >$@ | ||
|
||
|
||
#: Run pytest consistency and style checks | ||
check-consistency-and-style: | ||
MATHICS_LINT=t $(PYTHON) -m pytest test/consistency-and-style |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from mathics.core.load_builtin import import_and_load_builtins | ||
from mathics.session import MathicsSession | ||
|
||
import_and_load_builtins() | ||
|
||
session = MathicsSession(character_encoding="ASCII") | ||
|
||
|
||
def check_evaluation(str_expr: str, expected: str, message=""): | ||
"""Helper function to test that a Mathics expression against | ||
its results""" | ||
result = session.evaluate(str_expr).value | ||
|
||
if message: | ||
assert result == expected, f"{message}: got: {result}" | ||
else: | ||
assert result == expected | ||
|
||
|
||
def test_hello(): | ||
session.evaluate('LoadModule["pymathics.language"]') == "pymathics.language" | ||
check_evaluation('Alphabet["es"]//Length', 33) |