Skip to content

Commit 395eae0

Browse files
committed
fix for source download logic and tests for wget
1 parent 72f9a64 commit 395eae0

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

docs/requirements.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../test/requirements.txt

test/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ python3 -m venv <path to your venv>
3030
source <path to your venv>/bin/activate
3131
pip install --upgrade pip
3232
pip install -r test/requirements.txt
33-
pip install -r docs/requirements.txt
3433
```
3534

3635
Then just activate your virtual environment before running tests.

test/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
pylint
22
matplotlib > 3
3+
4+
# Requirements for building documentation.
5+
sphinx > 4.0
6+
sphinx_rtd_theme >= 1.0.0

test/tests/wget_tests.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
class TestWGet(PavTestCase):
1717

1818
GET_TARGET = "https://github.com/lanl/Pavilion/raw/master/README.md"
19+
GET_TARGET2 = "https://github.com/lanl/Pavilion/raw/master/RELEASE.txt"
1920
TARGET_HASH = '275fa3c8aeb10d145754388446be1f24bb16fb00'
2021

2122
_logger = logging.getLogger(__file__)
@@ -73,8 +74,6 @@ def test_update(self):
7374
# It should update the file if the info file isn't there and the
7475
# sizes don't match.
7576
ctime = dest_fn.stat().st_ctime
76-
with dest_fn.open('ab') as dest_file:
77-
dest_file.write(b'a')
7877
info_fn.unlink()
7978
try:
8079
wget.update(self.pav_cfg, self.GET_TARGET, dest_fn)
@@ -86,7 +85,6 @@ def test_update(self):
8685

8786
# We'll muck up the info file data, to force an update.
8887
db_data = {
89-
'ETag': 'nope',
9088
'Content-Length': '-1'
9189
}
9290
with info_fn.open('w') as info_file:
@@ -98,5 +96,21 @@ def test_update(self):
9896
new_ctime = dest_fn.stat().st_ctime
9997
self.assertNotEqual(new_ctime, ctime)
10098

101-
dest_fn.stat()
102-
info_fn.stat()
99+
ctime = new_ctime
100+
# Checking if a remote file change forces an update
101+
try:
102+
wget.update(self.pav_cfg, self.GET_TARGET2, dest_fn)
103+
except pavilion.errors.WGetError as err:
104+
self.fail("Failed with: {}".format(err.args[0]))
105+
new_ctime = dest_fn.stat().st_ctime
106+
self.assertNotEqual(new_ctime, ctime)
107+
108+
ctime = new_ctime
109+
# Make sure no updates happen if everything is the same
110+
try:
111+
wget.update(self.pav_cfg, self.GET_TARGET2, dest_fn)
112+
except pavilion.errors.WGetError as err:
113+
self.fail("Failed with: {}".format(err.args[0]))
114+
new_ctime = dest_fn.stat().st_ctime
115+
self.assertEqual(new_ctime, ctime)
116+

0 commit comments

Comments
 (0)