Coder Social home page Coder Social logo

pylons / deformdemo Goto Github PK

View Code? Open in Web Editor NEW
42.0 14.0 41.0 2.71 MB

Deform form generation framework demo application

Home Page: https://deformdemo.pylonsproject.org

License: Other

Python 99.05% Shell 0.59% Dockerfile 0.36%
deform colander pyramid pyramid-framework web-forms web-form peppercorn python python3 chameleon

deformdemo's Introduction

Deform Demo

https://github.com/Pylons/deformdemo/workflows/Build%20and%20test/badge.svg?branch=main

Demonstration application for the Deform Python HTML form library.

This application is tested on Python versions 3.8, 3.9, 3.10, 3.11, and 3.12, and PyPy3.

Online version

Visit https://deformdemo3.pylonsproject.org

Docker version

Build the Docker image for deformdemo and tag it.

# docker build --tag pylons/deformdemo3:<version> .
docker build --tag pylons/deformdemo3:main .

Run the built image with Docker.

docker run -d -p 8000:8523 pylons/deformdemo3:main

Then in your browser, visit http://localhost:8000

To stop the docker container, find its NAME and issue the stop command.

docker ps -a
docker stop <value_from_NAMES_column>

From source

  • Create a virtual environment.

    python3 -m venv /path/to/my/env

    Hereafter /path/to/my/env will be referred to as $VENV in the following steps.

  • Clone deformdemo.

    git clone git://github.com/Pylons/deformdemo.git
  • cd to the newly checked out deformdemo package.

    cd deformdemo
  • Run pip install -e . using the virtual environment's python command.

    $VENV/bin/pip install -e .
  • While your working directory is still deformdemo, start the demo application.

    $VENV/bin/pserve demo.ini
  • Visit http://localhost:8523 in a browser to see the demo.

Install functional test requirements

The deformdemo application serves as a target for functional testing during Deform's development. A suite of Selenium tests may be run against a local instance of the demonstration application. It is wise to run these tests using the following steps before submitting a pull request.

First prepare the functional test environment by installing requirements. We will assume that you put your projects in your user directory, although you can put them anywhere.

cd ~/projects/deformdemo/

Install Python development and testing requirements

The following command will install requirements for development and testing of deformdemo. It performs editable installs of Colander and Deform into your virtual environment's src directory, and deformdemo's testing requirements into lib/<python.version>/site-packages directory.

$VENV/bin/pip install -Ur requirements-dev.txt

Install Firefox latest

macOS Firefox

Download the latest version of Firefox for your platform.

Open the .dmg (macOS), and drag the Firefox icon to:

~/projects/deformdemo/

Linux (Debian) Firefox

Use cURL or wget. See the Firefox download README.txt for instructions. For example on Linux:

cd ~/projects/deformdemo/
wget -O firefox-latest.tar.bz2 \
"https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US"

Decompress the downloaded file.

tar -xjf firefox-latest.tar.bz2

geckodriver

Install the latest release of geckodriver.

# macOS
wget https://github.com/mozilla/geckodriver/releases/download/v0.29.0/geckodriver-v0.29.0-macos.tar.gz
tar -xzf geckodriver-v0.29.0-macos.tar.gz

# Linux (Debian)
wget https://github.com/mozilla/geckodriver/releases/download/v0.29.0/geckodriver-v0.29.0-linux64.tar.gz
tar -xzf geckodriver-v0.29.0-linux64.tar.gz

gettext

The functional tests require the installation of the GNU gettext utilities, specifically msgmerge and msgfmt. Use your package manager to install these requirements.

macOS gettext

Use Homebrew.

brew install gettext
brew link gettext --force

If you ever have problems building packages, you can always unlink it.

brew unlink gettext

Linux (Debian) gettext

apt-get install gettext
apt-get install gettext-base

Selenium

Selenium was already installed via $VENV/bin/pip install -Ur requirements-dev.txt.

Running the Demo's Functional Tests

  • Start the deformdemo application as described above in "Running the Demo". Leave the terminal window running this application open, and open a second terminal window to perform the below steps.

  • In the second terminal window, go to the "deformdemo" checkout directory you created above in "Running the Demo".

    cd ~/projects/deformdemo
  • Set an environment variable to add your local checkout of Deform to your PATH. It must to be set before running tox or pytest, otherwise Firefox or Chrome will not start and will return an error message such as 'geckodriver' executable needs to be in PATH.

    export PATH=~/projects/deform:$PATH
  • Run the tests.

    $VENV/bin/pytest

    $VENV is defined as it was in "Running the Demo" above.

  • You will (hopefully) see Firefox pop up and it will begin to display in quick succession the loading of pages. The tests will run for five or ten minutes.

  • Test success means that the console window on which you ran pytest shows a bunch of dots, a test summary, then OK. If it shows a traceback, FAILED, or anything other than a straight line of dots, it means there was an error.

  • Fix any errors by modifying your code or by modifying the tests to expect the changes you've made.

Testing an Alternate Renderer Implementation

  • Copy the demo.ini file from this demo package to your renderer's package.
  • Change the deform.renderer key in the demo.ini copy to point at your renderer (it's a Python dotted name).
  • Run pserve /path/to/your/copy/of/demo.ini.
  • Run the Selenium tests as above.

deformdemo's People

Contributors

benzheren avatar calvinhp avatar cguardia avatar cjw296 avatar dairiki avatar delijati avatar dependabot[bot] avatar dnouri avatar domenkozar avatar ergo avatar ericof avatar frispete avatar jandd avatar jdnavarro avatar kiorky avatar malthe avatar mcdonc avatar miohtama avatar mnaberez avatar mpeeters avatar multani avatar sbrauer avatar sontek avatar stevepiercy avatar sydoluciani avatar tdamsma avatar themanwithoutaplan avatar tonthon avatar tseaver avatar wichert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deformdemo's Issues

Revisions to deformdemo on master

@sydoluciani FYI I made a few changes to deformdemo on master because it should run all versions of Python and I found a simpler way to instantiate browser. Please make sure you pull master and compare the differences. Ignore all the fiddling around with lint, as I am juggling two things at once and did not want to interrupt the docker container testing by updating to the latest version of black.

Fix failed tests in Chrome and Opera

We need to rewrite the following tests which fail in Chrome and Opera, but succeed in Firefox.

Chrome

  • test_submit_selected (deformdemo.test.Select2WidgetTests)
  • test_submit_selected (deformdemo.test.Select2WidgetWithOptgroupTests)
  • test_submit_selected (deformdemo.test.Select2WidgetMultipleTests)

Opera

  • test_submit_date_empty (deformdemo.test.DateTimeInputWidgetTests)
  • test_submit_success (deformdemo.test.DateTimeInputWidgetTests)
  • test_submit_tooearly (deformdemo.test.DateTimeInputWidgetTests)
  • test_submit_selected (deformdemo.test.Select2WidgetTests)
  • test_submit_selected (deformdemo.test.Select2WidgetWithOptgroupTests)

See #85 (comment)

flaky required to run tests

It appears that flaky must be installed to run tests.

Steves-iMac:deformdemo stevepiercy$ env/bin/nosetests
<snip>
  File "/Users/stevepiercy/projects/deformdemo/deformdemo/test.py", line 15, in <module>
    from flaky import flaky
ModuleNotFoundError: No module named 'flaky'

----------------------------------------------------------------------
Ran 1 test in 0.265s

FAILED (errors=1)
Steves-iMac:deformdemo stevepiercy$ env/bin/pip install flaky
Collecting flaky
  Using cached https://files.pythonhosted.org/packages/fe/12/0f169abf1aa07c7edef4855cca53703d2e6b7ecbded7829588ac7e7e3424/flaky-3.6.1-py2.py3-none-any.whl
Installing collected packages: flaky
Successfully installed flaky-3.6.1
Steves-iMac:deformdemo stevepiercy$ env/bin/nosetests
Selenium says no
1569715494417   addons.manager  DEBUG   Application has been upgraded
# much happiness ensues
<snip>

Should I add it to testing in setup.py?

The example doesn't match

The example seems to be for doing cvs, whereas the form is for requiring one or the other fields.

The show in context looks like it lines 1341-1360

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.