A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/gabrielelanaro/emacs-for-python/wiki/Workflow-TDD below:

Workflow TDD · gabrielelanaro/emacs-for-python Wiki · GitHub

Workflow - Test Driven Developement

A common and effective approach to programming is Test Driven Developement. Here I will explain how emacs-for-python accomodates this practice.

The typical workflow for TDD is that:

Often writing tests is not really easy (expecially when dealing with user-interfaces and functional tests) anyway, you can just take the hint to "think ahead".

I usually put my test in a common directory, using a layout like that, but you may want to use the layout you prefer:

setup.py
   package
         __init__.py
         module1.py
         tests/
                 __init__.py
                 test_module1.py

To write new tests I use yasnippet snippets in particular testcase, and defm. In addition I want to suggest you a new delicious library for writing tests in a modern, pythonic way: Attest. IMHO, it is THE way to write tests.

You will also navigate all the time between files, I remaind you to the Tips and Rope Refactorings pages for tips about ultra-fast navigation (actually imenu and goto definition).

I've not yet developed an integrated testing extension for emacs-for-python, anyway there's a very effective replacement.

The builtin compile command, will run and parse output from a command, and hyperlink errors in files. The main problem with compile is that whether it does remember the command, doesn't remember the directory where the command was called. To solve this problem comes in compile-bookmarks (install it from ELPA for now, then I'll bundle it). With compile bookmarks a "Compile" voice will appear in your menubar (C- toggle-menubar), here you can add your compile bookmarks, it will also remember the directories.

Use M-x compile with a command to run tests from the correct directory, then click on Compile->Add and it will prompt you for command to add (the last one you typed).

You can also use the Virtualenv extension bundled and developed in emacs-for-python to use virtual environments when you're doing your testing.

For refactoring tips you may want to use the emacs built in editing features, they are powerful and fast enough to accomplish most of the tasks. There's also the dedicate rope refactoring library, I suggest to use it for most complex tasks like renaming functions in all the modules or extracting methods. You can read more about this subject in the Rope Refactorings page.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4