gns-deb-diff

automate the documentation of the differences between gNewSense and Debian.
git clone git://git.ricketyspace.net/gns-deb-diff.git
Log | Files | Refs

commit 48fe72f98790cb3eb661ee732957979417653b39
parent 3249ad81a1fa90b868c7ad44a3af72f08033dd6a
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun, 13 Nov 2016 02:09:31 +0000

Add `wiki_page_dir` function.

* gd_diff.py (wiki_page_dir): New function.
* tests/test_gd_diff.py (test_wiki_page_dir): Test for `wiki_page_dir`.

Diffstat:
gd_diff.py | 15+++++++++++++++
tests/test_gd_diff.py | 12++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/gd_diff.py b/gd_diff.py @@ -257,6 +257,21 @@ def readmes_dir(release): return rd_release +def wiki_page_dir(release): + """Get wiki page directory for `release`. + """ + wd = os.path.join(config_dir(), 'wiki-page') + + if not os.path.isdir(wd): + os.mkdir(wd) + + wd_release = os.path.join(wd, release) + if not os.path.isdir(wd_release): + os.mkdir(wd_release) + + return wd_release + + def configured_p(): """Returns True if gns-deb-diff is configured; False otherwise. """ diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py @@ -270,6 +270,18 @@ class TestGdDiff(object): assert_equal(os.path.isdir(rd_parkes), True) + def test_wiki_page_dir(self): + def env(e): + return self.test_home + + with mock.patch('os.getenv', new=env): + wd_parkes = wiki_page_dir('parkes') + assert_equal(wd_parkes, os.path.join(self.test_home, '.config', + 'gns-deb-diff', 'wiki-page', + 'parkes')) + assert_equal(os.path.isdir(wd_parkes), True) + + def test_configured_p_no(self): def env(e): return self.test_home