From 2fdf21bb14a47cf378ed8511f1ae5b9aed666e35 Mon Sep 17 00:00:00 2001 From: Pablo Buenaposada Date: Mon, 27 Apr 2020 19:48:30 +0200 Subject: [PATCH] Add first test Moved the source to it's own folder Added a first test structure Added travis ci --- .travis.yml | 7 +++++++ Makefile | 12 ++++++++++++ requirements.txt | 3 +++ wallapopy/__init__.py | 2 -- wallapopy/{ => src}/client.py | 4 +++- wallapopy/{ => src}/request_builder.py | 0 wallapopy/tests/test_client.py | 7 +++++++ 7 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 .travis.yml create mode 100644 Makefile create mode 100644 requirements.txt delete mode 100644 wallapopy/__init__.py rename wallapopy/{ => src}/client.py (89%) rename wallapopy/{ => src}/request_builder.py (100%) create mode 100644 wallapopy/tests/test_client.py diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6457e7a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: python + +python: +- '3.7' + +script: +- make test diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..83b3550 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +PIP="venv/bin/pip" +PYTHON="venv/bin/python" + +REQUIREMENTS:=requirements.txt + +virtualenv: + test -d venv || virtualenv -p python3.7 venv + $(PIP) install -U "pip" + $(PIP) install -r $(REQUIREMENTS) + +test: virtualenv + $(PYTHON) -m pytest wallapopy/tests diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..0af2a32 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +requests==2.23.0 +pytest +future==0.18.2 diff --git a/wallapopy/__init__.py b/wallapopy/__init__.py deleted file mode 100644 index 1c66e17..0000000 --- a/wallapopy/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from request_builder import WallapopRequestBuilder -from client import WallapopClient diff --git a/wallapopy/client.py b/wallapopy/src/client.py similarity index 89% rename from wallapopy/client.py rename to wallapopy/src/client.py index 1022e8f..ac3a9a6 100644 --- a/wallapopy/client.py +++ b/wallapopy/src/client.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- import requests -from request_builder import WallapopRequestBuilder + +from wallapopy.src.request_builder import WallapopRequestBuilder + class WallapopClient: diff --git a/wallapopy/request_builder.py b/wallapopy/src/request_builder.py similarity index 100% rename from wallapopy/request_builder.py rename to wallapopy/src/request_builder.py diff --git a/wallapopy/tests/test_client.py b/wallapopy/tests/test_client.py new file mode 100644 index 0000000..83a51d7 --- /dev/null +++ b/wallapopy/tests/test_client.py @@ -0,0 +1,7 @@ +from wallapopy.src.client import WallapopClient + + +class TestClient: + def test_instantiation(self): + """just checking that client can be instantiated""" + assert type(WallapopClient()) == WallapopClient