@@ -1388,35 +1388,41 @@ def runTest(self):
1388
1388
'FROM busybox' ,
1389
1389
'MAINTAINER docker-py' ,
1390
1390
'ADD . /test' ,
1391
- 'RUN ls -A /test' ,
1392
1391
]))
1393
1392
1394
1393
with open (os .path .join (base_dir , '.dockerignore' ), 'w' ) as f :
1395
1394
f .write ("\n " .join ([
1396
- 'node_modules ' ,
1395
+ 'ignored ' ,
1397
1396
'Dockerfile' ,
1398
- '.dockerginore ' ,
1397
+ '.dockerignore ' ,
1399
1398
'' , # empty line
1400
1399
]))
1401
1400
1402
1401
with open (os .path .join (base_dir , 'not-ignored' ), 'w' ) as f :
1403
1402
f .write ("this file should not be ignored" )
1404
1403
1405
- subdir = os .path .join (base_dir , 'node_modules ' , 'grunt-cli ' )
1404
+ subdir = os .path .join (base_dir , 'ignored ' , 'subdir ' )
1406
1405
os .makedirs (subdir )
1407
- with open (os .path .join (subdir , 'grunt ' ), 'w' ) as f :
1408
- f .write ("grunt " )
1406
+ with open (os .path .join (subdir , 'file ' ), 'w' ) as f :
1407
+ f .write ("this file should be ignored " )
1409
1408
1410
- stream = self .client .build (path = base_dir , stream = True )
1411
- logs = ''
1409
+ tag = 'docker-py-test-build-with-dockerignore'
1410
+ stream = self .client .build (
1411
+ path = base_dir ,
1412
+ tag = tag ,
1413
+ )
1412
1414
for chunk in stream :
1413
- if six .PY3 :
1414
- chunk = chunk .decode ('utf-8' )
1415
- logs += chunk
1416
- self .assertFalse ('node_modules' in logs )
1417
- self .assertFalse ('Dockerfile' in logs )
1418
- self .assertFalse ('.dockerginore' in logs )
1419
- self .assertTrue ('not-ignored' in logs )
1415
+ pass
1416
+
1417
+ c = self .client .create_container (tag , ['ls' , '-1A' , '/test' ])
1418
+ self .client .start (c )
1419
+ self .client .wait (c )
1420
+ logs = self .client .logs (c )
1421
+
1422
+ self .assertEqual (
1423
+ filter (None , logs .split ('\n ' )),
1424
+ ['not-ignored' ],
1425
+ )
1420
1426
1421
1427
#######################
1422
1428
# PY SPECIFIC TESTS #
0 commit comments