Mercurial > treepkg
comparison test/test_packager.py @ 495:ca95be9d033a
add tests for determine debian upstream version
fix calling determine_upstream_version in determine_package_version
update authors
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Thu, 14 Oct 2010 07:49:50 +0000 |
parents | fb92f3c1b238 |
children | e5b66539f893 |
comparison
equal
deleted
inserted
replaced
494:31b64ebe4b42 | 495:ca95be9d033a |
---|---|
1 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH | 1 # Copyright (C) 2007-2010 by Intevation GmbH |
2 # Authors: | 2 # Authors: |
3 # Bernhard Herzog <bh@intevation.de> | 3 # Bernhard Herzog <bh@intevation.de> |
4 # Bjoern Ricks <bjoern.ricks@intevation.de> | |
4 # | 5 # |
5 # This program is free software under the GPL (>=v2) | 6 # This program is free software under the GPL (>=v2) |
6 # Read the file COPYING coming with the software for details. | 7 # Read the file COPYING coming with the software for details. |
7 | 8 |
8 """Tests for treepkg.packager""" | 9 """Tests for treepkg.packager""" |
368 srcpkg = SourcePackager(revpkg) | 369 srcpkg = SourcePackager(revpkg) |
369 | 370 |
370 pkgbasedir = trackdir | 371 pkgbasedir = trackdir |
371 format = srcpkg.get_debian_source_format(pkgbasedir) | 372 format = srcpkg.get_debian_source_format(pkgbasedir) |
372 self.assertEqual("1.0", format) | 373 self.assertEqual("1.0", format) |
374 | |
375 class TestDetermineUpstreamVersion(unittest.TestCase, FileTestMixin): | |
376 | |
377 def test_debian_upstream_version(self): | |
378 trackdir = self.create_files("track", | |
379 [("debian", | |
380 [("changelog", """\ | |
381 testpkg (1.0.1~-1abc.173) unstable; urgency=low | |
382 | |
383 * Initial version | |
384 | |
385 -- TreePKG <treepkg@example.com> Thu, 8 Mar 2007 18:34:39 +0100 | |
386 """ | |
387 )]), | |
388 ("pkg", | |
389 [("704195-0", | |
390 [("status", | |
391 ("TreePackagerStatus 0.0\n" | |
392 "status: binary_package_created\n" | |
393 "start: 2007-09-10 17:16:48\n" | |
394 "stop: 2007-09-11 00:07:36\n")), | |
395 ("src", []), | |
396 ("binary", []) | |
397 ] | |
398 )] | |
399 )] | |
400 ) | |
401 track = PackageTrack("testtrack", trackdir, "", "", "", "", "") | |
402 revpkg = RevisionPackager(track, 704195, 0) | |
403 srcpkg = SourcePackager(revpkg) | |
404 | |
405 pkgbasedir = trackdir | |
406 version = srcpkg.determine_upstream_version() | |
407 self.assertEqual("1.0.1~", version) | |
408 | |
409 def test_debian_native_upstream_version(self): | |
410 trackdir = self.create_files("track", | |
411 [("debian", | |
412 [("changelog", """\ | |
413 testpkg (1.0.1) unstable; urgency=low | |
414 | |
415 * Initial version | |
416 | |
417 -- TreePKG <treepkg@example.com> Thu, 8 Mar 2007 18:34:39 +0100 | |
418 """ | |
419 )]), | |
420 ("pkg", | |
421 [("704195-0", | |
422 [("status", | |
423 ("TreePackagerStatus 0.0\n" | |
424 "status: binary_package_created\n" | |
425 "start: 2007-09-10 17:16:48\n" | |
426 "stop: 2007-09-11 00:07:36\n")), | |
427 ("src", []), | |
428 ("binary", []) | |
429 ] | |
430 )] | |
431 )] | |
432 ) | |
433 track = PackageTrack("testtrack", trackdir, "", "", "", "", "") | |
434 revpkg = RevisionPackager(track, 704195, 0) | |
435 srcpkg = SourcePackager(revpkg) | |
436 | |
437 pkgbasedir = trackdir | |
438 version = srcpkg.determine_upstream_version() | |
439 self.assertEqual("1.0.1", version) | |
440 | |
441 def test_debian_epoch_upstream_version(self): | |
442 trackdir = self.create_files("track", | |
443 [("debian", | |
444 [("changelog", """\ | |
445 testpkg (4:1.0.1-1abc3) unstable; urgency=low | |
446 | |
447 * Initial version | |
448 | |
449 -- TreePKG <treepkg@example.com> Thu, 8 Mar 2007 18:34:39 +0100 | |
450 """ | |
451 )]), | |
452 ("pkg", | |
453 [("704195-0", | |
454 [("status", | |
455 ("TreePackagerStatus 0.0\n" | |
456 "status: binary_package_created\n" | |
457 "start: 2007-09-10 17:16:48\n" | |
458 "stop: 2007-09-11 00:07:36\n")), | |
459 ("src", []), | |
460 ("binary", []) | |
461 ] | |
462 )] | |
463 )] | |
464 ) | |
465 track = PackageTrack("testtrack", trackdir, "", "", "", "", "") | |
466 revpkg = RevisionPackager(track, 704195, 0) | |
467 srcpkg = SourcePackager(revpkg) | |
468 | |
469 pkgbasedir = trackdir | |
470 version = srcpkg.determine_upstream_version() | |
471 self.assertEqual("1.0.1", version) | |
373 | 472 |
374 class TestRevisionPackager(unittest.TestCase, FileTestMixin): | 473 class TestRevisionPackager(unittest.TestCase, FileTestMixin): |
375 | 474 |
376 def test_list_source_files(self): | 475 def test_list_source_files(self): |
377 trackdir = self.create_files("track", | 476 trackdir = self.create_files("track", |