Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scopatz committed Dec 22, 2015
1 parent 5392d63 commit 2997735
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Some PyNE testing utilities."""
from __future__ import print_function
import os
import sys
from hashlib import md5
try:
import urllib.request as urllib
Expand All @@ -13,6 +15,8 @@ def download_file(url, localfile, md5_hash):
with open(localfile, "rb") as f:
html = f.read()
else:
msg = 'Downloading {0!r} to {1!r}'.format(url, localfile)
print(msg, file=sys.stderr)
req = urllib.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
f = urllib.urlopen(req, timeout=30.0)
try:
Expand Down
10 changes: 6 additions & 4 deletions tests/xs/test_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
from pyne.xs import data_source
from pyne.pyne_config import pyne_conf

if not os.path.isfile('W180.ace'):
u, f = 'https://www-nds.iaea.org/wolfram/w180/beta3/W180.ace', 'W180.ace'
print('Downloading {0} to {1} ...'.format(u, f), file=sys.stderr)
urllib.urlretrieve(u, f)
sys.path.insert(0, os.path.dirname(__file__))
from utils import download_file
del sys.path[0]

download_file('https://www-nds.iaea.org/wolfram/w180/beta3/W180.ace', 'W180.ace',
'5349513f196ad594d172bc6ea61dc382')

nuc_data = pyne_conf.NUC_DATA_PATH

Expand Down

0 comments on commit 2997735

Please sign in to comment.