mirror of
https://github.com/balkian/bitter.git
synced 2024-12-22 08:28:12 +00:00
Use easy in tests and README
This commit is contained in:
parent
b212a46ab7
commit
1cb86abbdd
14
Makefile
14
Makefile
@ -3,6 +3,9 @@ PYMAIN=$(firstword $(PYVERSIONS))
|
|||||||
NAME=bitter
|
NAME=bitter
|
||||||
REPO=balkian
|
REPO=balkian
|
||||||
VERSION=$(shell cat $(NAME)/VERSION)
|
VERSION=$(shell cat $(NAME)/VERSION)
|
||||||
|
TARNAME=$(NAME)-$(VERSION).tar.gz
|
||||||
|
IMAGENAME=$(REPO)/$(NAME)
|
||||||
|
IMAGEWTAG=$(IMAGENAME):$(VERSION)
|
||||||
|
|
||||||
|
|
||||||
all: build run
|
all: build run
|
||||||
@ -12,6 +15,17 @@ dockerfiles: $(addprefix Dockerfile-,$(PYVERSIONS))
|
|||||||
Dockerfile-%: Dockerfile.template
|
Dockerfile-%: Dockerfile.template
|
||||||
sed "s/{{PYVERSION}}/$*/" Dockerfile.template > Dockerfile-$*
|
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))
|
build: $(addprefix build-, $(PYMAIN))
|
||||||
|
|
||||||
buildall: $(addprefix build-, $(PYVERSIONS))
|
buildall: $(addprefix build-, $(PYVERSIONS))
|
||||||
|
@ -17,8 +17,8 @@ or
|
|||||||
Programmatically:
|
Programmatically:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from bitter.crawlers import TwitterQueue
|
from bitter import easy
|
||||||
wq = TwitterQueue.from_credentials()
|
wq = easy()
|
||||||
print(wq.users.show(user_name='balkian'))
|
print(wq.users.show(user_name='balkian'))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -5,14 +5,14 @@ import types
|
|||||||
import datetime
|
import datetime
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from bitter import utils
|
from bitter import utils, easy
|
||||||
from bitter.crawlers import TwitterQueue, TwitterWorker, QueueException
|
from bitter.crawlers import QueueException
|
||||||
from bitter import config as c
|
from bitter import config as c
|
||||||
|
|
||||||
class TestUtils(TestCase):
|
class TestCrawlers(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
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):
|
def test_create_worker(self):
|
||||||
assert len(self.wq.queue)==1
|
assert len(self.wq.queue)==1
|
||||||
|
Loading…
Reference in New Issue
Block a user