From 078d7416cd0deac7e6cf7e53a014efcba38e08d6 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 15 Sep 2015 09:00:25 +0200 Subject: [PATCH 1/2] update travis config, setup transifex --- .travis.yml | 23 ++++++++++++++--------- stock_reserve/test/stock_reserve.yml | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8914883b8..1f64de91b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,9 @@ # Config file .travis.yml +language: python +python: + - "2.7" + sudo: false cache: pip @@ -9,15 +13,16 @@ addons: - expect-dev # provides unbuffer utility - python-lxml # because pip installation is slow -language: python - -python: - - "2.7" - env: - - VERSION="8.0" LINT_CHECK="1" - - VERSION="8.0" ODOO_REPO="odoo/odoo" LINT_CHECK="0" - - VERSION="8.0" ODOO_REPO="OCA/OCB" LINT_CHECK="0" + global: + - VERSION="8.0" TESTS="0" LINT_CHECK="0" + - TRANSIFEX_USER='transbot@odoo-community.org' + - secure: tDsvZaY3JqmnjgyRuKkgQRtlRILkkjnHtZPWWaGg+KBD+BBH4AqX5ACTyu5U/J6Kr/Yb5NIoM3+NYRuASdGXnJb9siZvh/9B58B1wKUbC2umH4Yrpw66CEvG9JY4XMOCZni9kQBwQ7iMk5GfusDWuVuydZjd6dAqkCxz6JdkIco= + matrix: + - LINT_CHECK="1" + - TRANSIFEX="1" + - TESTS=1 ODOO_REPO="odoo/odoo" LINT_CHECK="0" + - TESTS=1 ODOO_REPO="OCA/OCB" LINT_CHECK="0" virtualenv: system_site_packages: true @@ -33,4 +38,4 @@ script: - travis_run_tests after_success: - coveralls + - travis_after_tests_success diff --git a/stock_reserve/test/stock_reserve.yml b/stock_reserve/test/stock_reserve.yml index 369b1563f..5565a92dd 100644 --- a/stock_reserve/test/stock_reserve.yml +++ b/stock_reserve/test/stock_reserve.yml @@ -92,7 +92,7 @@ The procurement linked to the orderpoint must be in exception (no routes configured) - !python {model: stock.warehouse.orderpoint}: | - orderpoint = self.browse(cr, uid, ref('sorbet_orderpoint')) + orderpoint = self.browse(cr, uid, ref('stock_reserve.sorbet_orderpoint')) assert orderpoint.procurement_ids[0].state == 'exception', 'procurement must be in exception as there is no rule for procurement' import math assert orderpoint.procurement_ids[0].product_qty == math.ceil(15 - 3.5), 'wrong product qty ordered' From 6d2aaa6ff6fbdb7c3b7892263894f2334c7ae776 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Tue, 15 Sep 2015 12:50:24 +0200 Subject: [PATCH 2/2] force recomputation of stock.location hierachy before running the tests. This fixes the failure experienced when running the test in --init mode rather than --update mode. --- stock_reserve/test/stock_reserve.yml | 14 +++++++++++--- stock_reserve_sale/test/sale_reserve.yml | 9 +++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/stock_reserve/test/stock_reserve.yml b/stock_reserve/test/stock_reserve.yml index 5565a92dd..586f7ca37 100644 --- a/stock_reserve/test/stock_reserve.yml +++ b/stock_reserve/test/stock_reserve.yml @@ -1,3 +1,12 @@ +- + I force recomputation of stock.location parent left/right +- + !python {model: stock.location}: + # we need this because when running the tests at install time as is done on + # Travis, the hook performing this operation for the new stock reservation + # location is run after the test execution. This causes the stock level + # computation to be wrong at the time the tests are run. + self._parent_store_compute(cr) - I create a product to test the stock reservation - @@ -33,9 +42,8 @@ - I check Virtual stock of Sorbet after update stock. - - !python {model: product.product}: | - product = self.browse(cr, uid, ref('stock_reserve.product_sorbet'), context=context) - assert product.virtual_available == 10, "Stock is not updated." + !python {model: product.product, id: product_sorbet}: | + assert self.virtual_available == 10, "Stock is not updated." - I create a stock reservation for 6 kgm - diff --git a/stock_reserve_sale/test/sale_reserve.yml b/stock_reserve_sale/test/sale_reserve.yml index 52e6a01b1..02acab415 100644 --- a/stock_reserve_sale/test/sale_reserve.yml +++ b/stock_reserve_sale/test/sale_reserve.yml @@ -1,3 +1,12 @@ +- + I force recomputation of stock.location parent left/right +- + !python {model: stock.location}: + # we need this because when running the tests at install time as is done on + # Travis, the hook performing this operation for the new stock reservation + # location is run after the test execution. This causes the stock level + # computation to be wrong at the time the tests are run. + self._parent_store_compute(cr) - I create a product to test the stock reservation -