.project
# Python
+.cache/
+.eggs/
.tox/
__pycache__/
*.egg-info/
'tests.*',
'tests'
]),
+ setup_requires=['pytest-runner'],
+ tests_require=['pytest'],
entry_points='''
[console_scripts]
lftools=lftools.cli:cli
release )
RELEASE_TAG=$1
echo "Bumping SNAPSHOTS to $RELEASE_TAG"
+ version_release
exit 0
;;
* )
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.linuxfoundation.releng</groupId>
+ <artifactId>test-artifact</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.linuxfoundation.releng</groupId>
+ <artifactId>test-artifact</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.linuxfoundation.releng</groupId>
+ <artifactId>test-artifact</artifactId>
+ <version>1.0.0-TestRelease</version>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.linuxfoundation.releng</groupId>
+ <artifactId>test-artifact</artifactId>
+ <version>1.0.1-SNAPSHOT</version>
+</project>
--- /dev/null
+import difflib
+from distutils import dir_util
+import filecmp
+import os
+
+import click
+import pytest
+
+from lftools import cli
+
+
+FIXTURE_DIR = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ 'fixtures',
+ )
+
+
+@pytest.mark.datafiles(
+ os.path.join(FIXTURE_DIR, 'pom.xml'),
+ os.path.join(FIXTURE_DIR, 'pom.xml.expected-bump'),
+ )
+def test_version_bump(cli_runner, datafiles):
+ os.chdir(datafiles)
+
+ # Version bump should bump versions by x.(y+1).z
+ result = cli_runner.invoke(cli.cli, ['version', 'bump', 'TestRelease'])
+ assert filecmp.cmp('pom.xml', 'pom.xml.expected-bump')
+
+
+@pytest.mark.datafiles(
+ os.path.join(FIXTURE_DIR, 'pom.xml'),
+ os.path.join(FIXTURE_DIR, 'pom.xml.expected-release'),
+ os.path.join(FIXTURE_DIR, 'pom.xml.expected-release-bump'),
+ )
+def test_version_release(cli_runner, datafiles):
+ os.chdir(datafiles)
+
+ # Version release should modify SNAPSHOT to TestRelease
+ result = cli_runner.invoke(cli.cli, ['version', 'release', 'TestRelease'])
+ assert filecmp.cmp('pom.xml', 'pom.xml.expected-release')
+
+ # Post release bump should bump versions by x.y.(z+1) and revert back to SNAPSHOT
+ result = cli_runner.invoke(cli.cli, ['version', 'bump', 'TestRelease'])
+ assert filecmp.cmp('pom.xml', 'pom.xml.expected-release-bump')
envlist =
coala,
docs,
- docs-linkcheck
+ docs-linkcheck,
+ py3
+
+[testenv]
+deps =
+ -r{toxinidir}/requirements.txt
+ pytest
+ pytest-click
+ pytest-datafiles
+commands = pytest
[testenv:coala]
basepython = python3