diff --git a/.hgignore b/.gitignore similarity index 59% rename from .hgignore rename to .gitignore index ffd82f1..1c2de1d 100644 --- a/.hgignore +++ b/.gitignore @@ -1,6 +1,3 @@ -# use glob syntax. -syntax: glob - *.pyc *.swp *.orig @@ -8,3 +5,4 @@ syntax: glob *.gz build/* .cache/* +env/* diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..68eb5db --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,14 @@ +stages: + - test + #- build + #- deploy + +test: + stage: test + tags: ["build"] + script: make test + artifacts: + paths: + - env.vanilla + expire_in: 1 hour + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..eb8929d --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +env: + python3 -m venv env + . env/bin/activate + env/bin/pip install --upgrade pip + +test: env + #env/bin/py.test --lf + env/bin/pip install --upgrade -r requirements-test.txt + env/bin/py.test + diff --git a/README.rst b/README.rst index 7352ac0..cd33405 100644 --- a/README.rst +++ b/README.rst @@ -122,4 +122,4 @@ License Public Revision Control ============================== -* https://git.unturf.com/python/miniuri +* https://git.unturf.com/python/ago diff --git a/ago/__init__.py b/ago/__init__.py new file mode 100644 index 0000000..50e34bc --- /dev/null +++ b/ago/__init__.py @@ -0,0 +1 @@ +from ago import * diff --git a/ago.py b/ago/ago.py similarity index 94% rename from ago.py rename to ago/ago.py index 8816d18..f81a04e 100644 --- a/ago.py +++ b/ago/ago.py @@ -32,9 +32,9 @@ def delta2dict(delta): "day": int(delta.days % 365), "hour": int(delta.seconds / 3600), "minute": int(delta.seconds / 60) % 60, - "second": delta.seconds % 60, - "millisecond": delta.microseconds / 1000, - "microsecond": delta.microseconds % 1000, + "second": int(delta.seconds % 60), + "millisecond": int(delta.microseconds / 1000), + "microsecond": int(delta.microseconds % 1000), } diff --git a/ago/tests/__init__.py b/ago/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_ago.py b/ago/tests/test_ago.py similarity index 98% rename from test_ago.py rename to ago/tests/test_ago.py index d55b2b3..3dbafb0 100644 --- a/test_ago.py +++ b/ago/tests/test_ago.py @@ -2,8 +2,8 @@ from __future__ import print_function from datetime import datetime, timedelta, tzinfo -from ago import human -from ago import delta2dict +from ..ago import human +from ..ago import delta2dict # datetime objects PRESENT = datetime.now() diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..e83cf3d --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,5 @@ +# testing. +pytest +pytest-cov +nose +twine diff --git a/setup.py b/setup.py index bc75a85..af6b5cc 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ # installation: pip install ago -from setuptools import setup +from setuptools import setup, find_packages setup( name="ago", @@ -10,7 +10,8 @@ setup( long_description=open("README.rst").read(), author="Russell Ballestrini", author_email="russell.ballestrini@gmail.com", - url="https://git.unturf.com/python/miniuri" + url="https://git.unturf.com/python/ago", + packages=find_packages(exclude="tests"), platforms=["All"], license="Public Domain", py_modules=["ago"], @@ -20,4 +21,6 @@ setup( # setup keyword args: http://peak.telecommunity.com/DevCenter/setuptools # built and uploaded to pypi with this: -# python setup.py sdist bdist_egg register upload +#python setup.py sdist bdist_egg +#twine upload dist/* +