add docker tests and fix sorting
This commit is contained in:
		
							
								
								
									
										6
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								Makefile
									
									
									
									
									
								
							@@ -6,6 +6,12 @@ shell:
 | 
				
			|||||||
test:
 | 
					test:
 | 
				
			||||||
	pipenv run python -m unittest discover
 | 
						pipenv run python -m unittest discover
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					docker-tests:
 | 
				
			||||||
 | 
						docker run --pull=always -v `pwd`:/app -w /app --rm -it python:3.11-alpine sh runtests.sh
 | 
				
			||||||
 | 
						docker run --pull=always -v `pwd`:/app -w /app --rm -it python:3.10-alpine sh runtests.sh
 | 
				
			||||||
 | 
						docker run --pull=always -v `pwd`:/app -w /app --rm -it python:3.11 sh runtests.sh
 | 
				
			||||||
 | 
						docker run --pull=always -v `pwd`:/app -w /app --rm -it python:3.10 sh runtests.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
requirements.txt: Pipfile.lock
 | 
					requirements.txt: Pipfile.lock
 | 
				
			||||||
	pipenv requirements > requirements.txt
 | 
						pipenv requirements > requirements.txt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,8 +118,7 @@ def get_mails_list(dirpath: Path) -> list[MailEntry]:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def set_nid(entries: list[MailEntry]):
 | 
					def set_nid(entries: list[MailEntry]):
 | 
				
			||||||
    entries.sort(reverse=True, key=lambda e: e.c_time)
 | 
					    entries.sort(reverse=True, key=lambda e: (e.c_time, e.uid))
 | 
				
			||||||
    entries = sorted(entries, reverse=True, key=lambda e: e.c_time)
 | 
					 | 
				
			||||||
    for i, entry in enumerate(entries, start=1):
 | 
					    for i, entry in enumerate(entries, start=1):
 | 
				
			||||||
        entry.nid = i
 | 
					        entry.nid = i
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,7 +50,7 @@ class MyHandler(AsyncMessage):
 | 
				
			|||||||
                gen = BytesGenerator(fp, policy=email.policy.SMTP)
 | 
					                gen = BytesGenerator(fp, policy=email.policy.SMTP)
 | 
				
			||||||
                gen.flatten(m)
 | 
					                gen.flatten(m)
 | 
				
			||||||
            for mbox in all_mboxes:
 | 
					            for mbox in all_mboxes:
 | 
				
			||||||
                shutil.copy2(temp_email_path, self.mails_path / mbox / 'new')
 | 
					                shutil.copy(temp_email_path, self.mails_path / mbox / 'new')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def protocol_factory_starttls(mails_path: Path,
 | 
					def protocol_factory_starttls(mails_path: Path,
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								runtests.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										8
									
								
								runtests.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					python3 -m venv /tmp/m41.venv
 | 
				
			||||||
 | 
					. /tmp/m41.venv/bin/activate
 | 
				
			||||||
 | 
					python3 -m pip install -q -r requirements.txt
 | 
				
			||||||
 | 
					python3 -m unittest discover
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Reference in New Issue
	
	Block a user