From 1cb86abbdd5930156150b3a272951deec34d4aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Wed, 8 Mar 2017 12:15:48 +0100 Subject: [PATCH] Use easy in tests and README --- Makefile | 14 ++++++++++++++ README.md | 4 ++-- tests/test_crawlers.py | 8 ++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f240584..554a573 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,9 @@ PYMAIN=$(firstword $(PYVERSIONS)) NAME=bitter REPO=balkian VERSION=$(shell cat $(NAME)/VERSION) +TARNAME=$(NAME)-$(VERSION).tar.gz +IMAGENAME=$(REPO)/$(NAME) +IMAGEWTAG=$(IMAGENAME):$(VERSION) all: build run @@ -12,6 +15,17 @@ dockerfiles: $(addprefix Dockerfile-,$(PYVERSIONS)) Dockerfile-%: Dockerfile.template sed "s/{{PYVERSION}}/$*/" Dockerfile.template > Dockerfile-$* + +dev-%: + @docker start $(NAME)-dev$* || (\ + $(MAKE) build-$*; \ + docker run -d -w /usr/src/app/ -v $$PWD:/usr/src/app --entrypoint=/bin/bash -ti --name $(NAME)-dev$* '$(IMAGEWTAG)-python$*'; \ + )\ + + docker exec -ti $(NAME)-dev$* bash + +dev: dev-$(PYMAIN) + build: $(addprefix build-, $(PYMAIN)) buildall: $(addprefix build-, $(PYVERSIONS)) diff --git a/README.md b/README.md index c92201a..db26060 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ or Programmatically: ```python -from bitter.crawlers import TwitterQueue -wq = TwitterQueue.from_credentials() +from bitter import easy +wq = easy() print(wq.users.show(user_name='balkian')) ``` diff --git a/tests/test_crawlers.py b/tests/test_crawlers.py index dc2e8f6..9871dcc 100644 --- a/tests/test_crawlers.py +++ b/tests/test_crawlers.py @@ -5,14 +5,14 @@ import types import datetime import time -from bitter import utils -from bitter.crawlers import TwitterQueue, TwitterWorker, QueueException +from bitter import utils, easy +from bitter.crawlers import QueueException from bitter import config as c -class TestUtils(TestCase): +class TestCrawlers(TestCase): def setUp(self): - self.wq = TwitterQueue.from_credentials(os.path.join(os.path.dirname(__file__), 'credentials.json')) + self.wq = easy(os.path.join(os.path.dirname(__file__), 'credentials.json')) def test_create_worker(self): assert len(self.wq.queue)==1