我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用setup.VERSION。
def test_version(self): """ Test that setup.py's version matches the package's version. """ original_path = list(sys.path) sys.path.insert(0, self.project_dir) try: from setup import VERSION self.assertEqual(VERSION, pystache.__version__) finally: sys.path = original_path
def parse_args(): opts = docopt(__doc__, version='.'.join(VERSION)) schema = Schema({ Optional('PACK_TYPE'): Or(None, lambda s: s.lower() in PACKS_TYPE, error="PACK_TYPE should be either %s" % (', '.join(PACKS_TYPE))), Optional('--config'): Or(None, Use(open), error="--config must be a readable file"), Optional('--attempts'): And(Use(int), lambda n: n > 0, error='--attempts must be a strictly positive integer'), Optional('--score'): And(Use(int), error='--score must be an integer'), Optional('--threshold'): And(Use(int), lambda n: n >= 0, error='--threshold must be a positive integer'), Optional('--low-threshold'): And(Use(int), lambda n: n > 0, error='--low-threshold must be a strictly positive integer'), Optional('--wait'): And(Use(int), lambda n: n >= 0, error='--wait must be a positive integer'), object: object, }) opts = schema.validate(opts) opts['PACK_TYPE'] = opts['PACK_TYPE'].lower() if opts['PACK_TYPE'] else "wild" if opts['--config']: config = simplejson.loads(opts['--config'].read()) opts.update(config) return opts
def test_version(self): import setup self.assertEqual(fatoptimizer.__version__, setup.VERSION)
def test_version_tuple(self): self.assertIsInstance(perf.VERSION, tuple) self.assertTrue(all(isinstance(part, int) for part in perf.VERSION), perf.VERSION)
def test_version_str(self): self.assertIsInstance(perf.__version__, str) self.assertEqual(perf.__version__, '.'.join(str(part) for part in perf.VERSION))
def test_setup_version(self): import setup self.assertEqual(perf.__version__, setup.VERSION)
def test_version(self): import setup self.assertEqual(bytecode.__version__, setup.VERSION)