[tox] Use generating environments
Drop the "env" option, which is unknown, and set a generative_ "envlist". Then
use conditional dependencies based on factors_ to avoid repeating environment
sections. The only singular one is the "cubicweb" environment because of its
"commands".
At some point, it'd be nice to find a way to have python version prefixes
(py27-hooks or py34-web) for environment names but I could not find a way to extract
the package name from such names.
.. _generative: http://tox.readthedocs.org/en/latest/config.html#generative-envlist
.. _factors: http://tox.readthedocs.org/en/latest/config.html#factors-and-factor-conditional-settings
# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr## This file is part of CubicWeb.## CubicWeb is free software: you can redistribute it and/or modify it under the# terms of the GNU Lesser General Public License as published by the Free# Software Foundation, either version 2.1 of the License, or (at your option)# any later version.## CubicWeb is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more# details.## You should have received a copy of the GNU Lesser General Public License along# with CubicWeb. If not, see <http://www.gnu.org/licenses/>."""unit tests for cubicweb.devtools.fill module"""importrefromlogilab.common.testlibimportTestCase,unittest_mainfromcubicweb.devtools.fillimportValueGenerator,_ValueGeneratorISODATE_SRE=re.compile('(?P<year>\d{4})-(?P<month>\d{2})-(?P<day>\d{2})$')classAutoExtendableTC(TestCase):defsetUp(self):self.attrvalues=dir(_ValueGenerator)deftearDown(self):attrvalues=set(dir(_ValueGenerator))forattrnameinattrvalues-set(self.attrvalues):delattr(_ValueGenerator,attrname)deftest_autoextend(self):self.assertNotIn('generate_server',dir(ValueGenerator))classMyValueGenerator(ValueGenerator):defgenerate_server(self,index):returnattrnameself.assertIn('generate_server',dir(ValueGenerator))deftest_bad_signature_detection(self):self.assertNotIn('generate_server',dir(ValueGenerator))try:classMyValueGenerator(ValueGenerator):defgenerate_server(self):passexceptTypeError:self.assertNotIn('generate_server',dir(ValueGenerator))else:self.fail('TypeError not raised')deftest_signature_extension(self):self.assertNotIn('generate_server',dir(ValueGenerator))classMyValueGenerator(ValueGenerator):defgenerate_server(self,index,foo):passself.assertIn('generate_server',dir(ValueGenerator))if__name__=='__main__':unittest_main()