Skip to content

Commit

Permalink
Merge 49a1ed8 into 199057d
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgalvez-tiendeo committed Feb 15, 2021
2 parents 199057d + 49a1ed8 commit a391dd3
Show file tree
Hide file tree
Showing 16 changed files with 477 additions and 1,158 deletions.
40 changes: 34 additions & 6 deletions .travis.yml
@@ -1,20 +1,48 @@
language: python
python:
- 2.7
- 3.6
- 3.7
- 3.8

before_install:
- python -V # Print out python version for debugging
- pip install virtualenv
- virtualenv ${HOME}/venv
- source ${HOME}/venv/bin/activate

# Install CA certs, openssl to https downloads, python for gcloud sdk
- sudo apt-get install make ca-certificates openssl python
- sudo update-ca-certificates

# Install Java
- sudo wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -
- sudo apt-get update
- sudo apt-get install -y software-properties-common
- sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
- sudo apt-get -q update
- sudo apt-get install -y adoptopenjdk-8-hotspot

# Download the latest version of the GAE Python SDK
- curl https://sdk.cloud.google.com > install.sh
- bash install.sh --disable-prompts --install-dir=${HOME}
- source ${HOME}/google-cloud-sdk/path.bash.inc
- gcloud --quiet components update
- gcloud --quiet components install cloud-datastore-emulator
- gcloud --quiet components install beta
- gcloud --quiet components install appctl
- gcloud --quiet components install cloud-build-local
- gcloud --quiet components install app-engine-python
- gcloud --quiet components install app-engine-python-extras

# command to install dependencies
install:
- "pip install ."
- "pip install -r tests/requirements.txt"
# Download the latest version of the GAE Python SDK
- "wget https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.30.zip -nv -O downloaded_appengine.zip"
- "unzip -q downloaded_appengine.zip"
# This is a quick hack, necessary to get fancy_urllib working,
# by exposing the lib/fancy_urllib/fancy_urllib/ dirctory within for use by appengine.
- "rm -rf google_appengine/lib/fancy_urllib/__init__.py"

# command to run tests
script: "coverage run --source=wtforms_appengine `which nosetests` -w tests --with-gae --gae-lib-root=google_appengine"
script: "pytest --cov wtforms_appengine tests"

after_success:
- pip install coveralls
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
@@ -0,0 +1,2 @@
WTForms>=2.0
google-cloud-ndb>=1.7.1
14 changes: 8 additions & 6 deletions setup.py
@@ -1,9 +1,14 @@
from codecs import open
from setuptools import setup, find_packages

dependencies = [
'WTForms>=1.0.5',
'google-cloud-ndb>=1.7.1'
]

setup(
name='WTForms-Appengine',
version='0.1',
version='0.2',
url='http://github.com/wtforms/wtforms-appengine/',
license='BSD',
author='Thomas Johansson, James Crasta',
Expand All @@ -17,8 +22,6 @@
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
Expand All @@ -28,9 +31,8 @@
packages=find_packages(),
package_data={
},
install_requires=['WTForms>=1.0.5'],
extras_require={
},
install_requires=dependencies,
extras_require={},
test_suite='nose.collector',
tests_require=['nose'],
)
2 changes: 1 addition & 1 deletion tests/app.yaml
@@ -1,6 +1,6 @@
application: my-app
version: 1
runtime: python27
runtime: python37
api_version: 1
threadsafe: no

Expand Down
26 changes: 26 additions & 0 deletions tests/conftest.py
@@ -0,0 +1,26 @@
"""py.test shared testing configuration.
This defines fixtures (expected to be) shared across different test
modules.
"""

import pytest
from dsemu import Emulator
from google.cloud import ndb


@pytest.fixture(scope="session")
def emulator():
with Emulator() as emulator:
yield emulator


@pytest.fixture(scope="session")
def session_client():
client = ndb.Client(project="test")
yield client


@pytest.fixture()
def client(emulator: Emulator, session_client: ndb.Client):
emulator.reset()
yield session_client
36 changes: 0 additions & 36 deletions tests/gaetest_common.py
Expand Up @@ -11,11 +11,6 @@
if BASE_DIR not in sys.path:
sys.path.insert(0, BASE_DIR)

from unittest import TestCase

from google.appengine.ext import ndb, testbed
from google.appengine.datastore import datastore_stub_util


SAMPLE_AUTHORS = (
('Bob', 'Boston'),
Expand Down Expand Up @@ -45,34 +40,3 @@ def fill_authors(Author):
authors.append(author)
AGE_BASE += 1
return authors


class NDBTestCase(TestCase):
def setUp(self):
self.testbed = testbed.Testbed()
self.testbed.activate()

policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(
probability=1)
self.testbed.init_datastore_v3_stub(consistency_policy=policy)

ctx = ndb.get_context()
ctx.set_cache_policy(False)
ctx.set_memcache_policy(False)

def tearDown(self):
self.testbed.deactivate()



class DBTestCase(TestCase):
def setUp(self):
self.testbed = testbed.Testbed()
self.testbed.activate()

policy = datastore_stub_util.PseudoRandomHRConsistencyPolicy(
probability=1)
self.testbed.init_datastore_v3_stub(consistency_policy=policy)

def tearDown(self):
self.testbed.deactivate()
8 changes: 4 additions & 4 deletions tests/requirements.txt
@@ -1,4 +1,4 @@
coverage
nose
WTForms>=1.0.5
nosegae
-r ../requirements.txt
dsemu
pytest
pytest-cov
3 changes: 2 additions & 1 deletion tests/second_ndb_module.py
@@ -1,4 +1,5 @@
from google.appengine.ext import ndb
from google.cloud import ndb


class SecondBook(ndb.Model):
author = ndb.KeyProperty(kind='Author')

0 comments on commit a391dd3

Please sign in to comment.