Giter Club home page Giter Club logo

python-testing's Introduction

Testing

An introduction to testing and continuous integration using Python.

Much of this lesson came from the book Effective Computation in Physics by Anthony M. Scopatz and Kathryn D. Huff.

Note

Please see GitHub.com/Carpentries/lesson-example for instructions on formatting, building, and submitting lessons, or run make in this directory for a list of helpful commands.

python-testing's People

Contributors

aaren avatar abbycabs avatar abought avatar andreww avatar anelda avatar bast avatar bkatiemills avatar dejmail avatar evanwill avatar fmichonneau avatar gdevenyi avatar gvwilson avatar jarmokivekas avatar jdblischak avatar jduckles avatar jpallen avatar katrinleinweber avatar katyhuff avatar konrad avatar lexnederbragt avatar markcmiller86 avatar mstimberg avatar pbanaszkiewicz avatar petebachant avatar pipitone avatar rgaiacs avatar synesthesiam avatar tbekolay avatar twitwi avatar wking 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  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

python-testing's Issues

Can't navigate pages

There are no "next" arrow or buttons on any page. The user has to go back to the main page every time to select the next chapter.

Consider including linting/formatting tools?

Great to see a workshop in progress on Python testing and CI! I'm curious whether including a short section on how to use tools like pylint and black might fit in well here. They're be out of scope if you really want to keep the focus on testing, but they'd fit in with the broader bucket of useful tools for maintaining quality code that can be used with CI.

Test parameterisation

Is there value in adding material to cover simple test parameterisation?

I imagine this could fit in after edge and corner cases, reuse the sinc2d example, and make use of the @pytest.mark.parametrize decorator (docs are at https://docs.pytest.org/en/latest/parametrize.html). Essentially this could be "something else useful that pytest does" and could be a task of refactoring the collection of edge and corner case tests.

As I see it there are two down sides of this. First, it would make the lesson longer, and that's not necessarily a good thing. Second, it would make use of decorators, and these would probably be new to many learners.

template and styling

Hi Katy

I have been in contact with Greg and Jonah from Software Carpentry, as I thought to present a Unit Testing course to the scientists in my region (and possibly punt your book!). They said that the course you have prepared is great, although suggested that I could contribute by bringing the template and styling up to date. Would you be ok with that ? Greg said he would be able to help me along with getting through what needs to be altered and that it shouldn't be a huge amount of work.

Sincerely
Liam

Solution to test_complex() exercise

In http://katyhuff.github.io/python-testing/05-pytest/, there is an exercise at the end to make all tests pass by ensuring mean.py handles complex number by returning NotImplemented. What is the preferred solution? I came up with adding this at the beginning:

    if isinstance(sum(num_list), complex):
        return NotImplemented

This works, but causes test_long to take much more time (due to the summing of 100000000 numbers).

(@annefou and I'll be teaching this workshop in two weeks, hence the question)

py.test is now pytest

The latest version of pytest has pytest as its command. py.test still works, but it may still be worth to update the lesson on this point.

Add lint to travisCI text

I taught this lesson yesterday as part of a more-advanced SWC workshop for 30. It's great! While I remember one common problem the students hit in the Continuous Integration part is that travisCI is very picky about the format of the .travis.yaml file. It's probably worth adding a note about this either in the lesson or in the instructor notes.

A useful tool to point to would be the travis.yaml linter at https://lint.travis-ci.org/ and maybe note some common error cases somewhere. These seem to be:

  • .travis.yaml is malformed. There is an error message at the top of the job log, and pointing to the linter is probably the best plan.
  • the tests fail and end with a message about "rake". This is an attempt to run tests for Ruby (the default case for Travis) and this probably means that the .travis.yaml has not been found. A common reason seems to be that people forget the first dot at the start of the filename. The fix is to rename (git mv ..., git commit, git push) and try again.
  • the tests don't run. This happens if the student adds the files and commits them before turning on tests for the repository in travis (I think there is a bit of a delay between linking the travis and github account and being able to do anything, so if the student moves on to keep up they may do the push before flipping the switch in travis). The fix is to push some other change to the repo.

Anyway, I'll try to turn these into a pull request when I get a chance, but at least if I stick this here I'll not completely forget.

Lesson 5 missing

Lesson 5 "Running Tests with pytest" is absent from this repo.

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.