EzDevInfo.com

pybuilder

Continuous build tool for Python. PyBuilder an easy to use continuous build tool for Python pybuilder is an extendible, easy to use continuous build tool for python.

How do you run doctests from pybuilder?

There are examples for unittests in the docs and much of this is already integrated into pybuilder.

How do you run doctests in a target?


Source: (StackOverflow)

How do I configure pybuilder?

How can I change the configuration in pybuilder, and how does the configuration in pybuilder work?.

How Do I find out the possible configuration values and their defaults, how do I override or change them per project / per module / on the commmmandline / in settings files? Which are the settings files?


Source: (StackOverflow)

Advertisements

Pybuilder integration tests on a Django project

I'm trying to write integration tests with pybuilder on a Django web application, but I can't seem to make it work. An example error which occurs (from within the Django application):

django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

DJANGO_SETTINGS_MODULE is defined in build.py, like so:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")

The project is stored in src/main/python and integration tests are in src/integrationtest/python, like pybuilder's docs say it should be.

I've tried to manually set DJANGO_SETTINGS_MODULE in a lot of different places, including build.py and the test case itself. The same applies for settings.configure(). But it simply doesn't want to work and I don't know what I'm missing. I've ran out of ideas what to try.


Source: (StackOverflow)

pybuilder and pytest: cannot import source code when running tests

so i have a project:

<root>
|- src
     |-main
         |-python
            |-data_merger
                |- common
                |- constans
                |- controller
                |- resources
                |- rest
     |-tests
         |-unittest
         |-integrationtest

data_merger is marked as root (I am using Pycharm). This is part of my build file:

@init

def set_properties(project):
    project.set_property("dir_source_main_python", r"src\main\python\data_merger")
    project.set_property("dir_source_integrationtest_python", r"src\tests\integrationtest")
    project.set_property("dir_source_unittest_python", r"src\tests\unittest")
    project.set_property("unittest_module_glob", "*_test.py")
    project.set_property("unittest_test_method_prefix", "test_")
    project.set_property("run_unit_tests_command",
    "py.test %s" % project.expand_path("$dir_source_unittest_python"))
    project.set_property("run_unit_tests_propagate_stdout", True)
    project.set_property("run_unit_tests_propagate_stderr", True)
    project.set_property("teamcity_output", True)

when I build my project i get the following error that it cannot import my source code:

 ←[1m[INFO] ←[0;0m  ERROR collecting src/tests/unittest/python/data_merger/controller/comparator_autom_params_test.py
←[1m[INFO] ←[0;0m src\tests\unittest\python\data_merger\controller\comparator_autom_params_test.py:6: in <module>
←[1m[INFO] ←[0;0m     from resources.diff_table import DiffTable
←[1m[INFO] ←[0;0m E   ImportError: No module named resources.diff_table

Source: (StackOverflow)

PyBuilder broken for Swig-Python generated wrapper project

I have a Python wrapper (to a C lib) generated by Swig.

Have unittest run happy within PyDev.

Project structure follow PyBuilder suggested setup:

   |-src
      |-main
          |-python
                |-A.py
                |-_A.so
      |-unittest
          |-python
                |-A_tests.py

when try run pyb, got following error:

Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6

NOTE: If I change A to a pure Python module, everything works.

Must be something (step) missing related to load that .so file.

Sorry for a newbie question like this. Any help will be greatly appreciated.


Source: (StackOverflow)