@@ -54,20 +54,29 @@ def test_dir(self, bunch):
5454
5555def test_read_description ():
5656 descr = base ._read_description ("adk_equilibrium.rst" )
57- assert len (descr ) == 1252
58- assert descr .startswith (".. -*- coding: utf-8 -*-\n \n .. _`adk-equilibrium-dataset`:" )
57+ assert (descr .startswith ( # UNIX
58+ ".. -*- coding: utf-8 -*-\n \n .. _`adk-equilibrium-dataset`:" ) or
59+ descr .startswith ( # Windows
60+ ".. -*- coding: utf-8 -*-\r \n \r \n .. _`adk-equilibrium-dataset`:" ))
61+ # descr is read with automatic line ending conversion so by splitting into
62+ # words we don't need to care about that (len(descr) differs between UNIX
63+ # and Windows)
64+ n_words = len (descr .split ())
65+ assert n_words == 153
5966
6067def test_sha256 (tmpdir , some_text ):
6168 filename = "address.txt"
6269 with tmpdir .as_cwd ():
63- with open (filename , "w " ) as txt :
64- txt .write (some_text )
70+ with open (filename , "wb " ) as txt :
71+ txt .write (some_text . encode ( "utf-8" ) )
6572 checksum = base ._sha256 (filename )
6673 assert checksum == "4446bfb2ec5dedfbd981d059d6005f5144b067b392a00e3bcf98f8302ec8f765"
6774
6875@pytest .mark .parametrize ('data_home,location' , [
69- (None , pathlib .Path ("~/MDAnalysis_data" ).expanduser ()),
70- (str (pathlib .Path ("/tmp/MDAnalysisData" )), pathlib .Path ("/tmp/MDAnalysisData" )),
76+ (None ,
77+ pathlib .Path ("~/MDAnalysis_data" ).expanduser ()),
78+ (str (pathlib .Path ("/tmp/MDAnalysisData" )),
79+ pathlib .Path ("/tmp/MDAnalysisData" )),
7180 ])
7281def test_get_data_home (data_home , location ):
7382 assert base .get_data_home (data_home = data_home ) == str (location )
0 commit comments